Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 16, 2012 07:49 AM by Peter pi - MSFT
Feb 09, 2012 06:59 PM|LINK
Using VS 2010. My Web Service is working fine. But while 'Consuming' from a 'Windows Forms Application', it fails..! Prolem started after I installed VS 2010 SP1. I have uninstalled the VS2010 SP1, VS2010 and VS Web Developer 2010 and Reinstalled all (without
the VS 2010 SP1..!)
This is the following Error Message I get while 'Add Web Reference' --> 'Go' ( Err:
Web Services Found at this URL:
There was an error downloading 'http://localhost:1451/Service1.asmx'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:1451
There was an error downloading 'http://localhost:1451/Service1.asmx/$metadata'.
Unable to connect
--- Please help me what is wrong or changes I need to do.
Feb 09, 2012 07:23 PM|LINK
Did you host your application in iis?
If you dont then host it and then try to add the reference from the url you have hosted.
Feb 09, 2012 07:30 PM|LINK
I am new to .net, please explain me in detail what exactly I need to do ?
Say My URL: http://localhost:1451/Service1.asmx
From my 'Windows Forms Application' , I am referencing this (as per the Book !!) now I can open my IIS (Start --> Run --> inetmgr). Now pl. explain how to host this URL?
Feb 09, 2012 07:37 PM|LINK
Go to your iis
There are lots of articles available.
Basically you go to iis and then add your web service as an application.
so it will give you url like this
Feb 09, 2012 08:43 PM|LINK
I installed VS 2010 Ultimate and SQL Server 2008 R in this same XP Professional Machine. I have IIS 5.1 running. So the above link for adding Web Site does not work or may be has to be done in different way.
So, advise me on IIS 5.1 bases.
Feb 09, 2012 08:57 PM|LINK
Go to your iis.
Try to find Sites under Start Page and your computer name on left side.
Then click on Sites and then click on Default Web Site.
Right cilck on Default Site and Add Application.
In Add Application pop up put the information and under physical path where is your web service is located.
Give the name whatever you want to give in alias.
Then click on that newly created site and browse from the right side.
The url you get try to use that url in your visual studio when you try to add reference.
Feb 09, 2012 10:03 PM|LINK
in IIS 5.1, thesr is no 'Add Web Site' by right clicl on 'Default Web Site'. In the Property Tab pages, I don't see any.
Internet research on IIS 5.1 http://forums.iis.net/t/1138192.aspx says can't add more than one 'default' web site
Feb 09, 2012 11:16 PM|LINK
Check for Add Application or Add Virtual Directory.
Feb 10, 2012 06:57 PM|LINK
I have added the following link to the IIS 5.1 --> "Home Directory" Tab --> Application Name
C:\Project Workplace\ASP.NET Web Services\AddNumbers\AddNumbers\Service1.asmx
Restarted the IIS and Ran the application .. did not work,
Then I put C:\Project Workplace\ASP.NET Web Services\AddNumbers\WebClient\Form1.cs
in the IIS 5.1 --> "Home Directory" Tab --> Application Name
Restarted the IIS and Ran the application .. STILL did not work,
My Client Application in in the same Project of the the "Seb Service" it can Reference the Web Service "Discovery" button.
But While Run time it only shows the following Error:-
Tuesday, February 07, 2012 09:30 AM <dir> App_Data
Friday, February 10, 2012 12:32 PM <dir> bin
Tuesday, February 07, 2012 09:30 AM <dir> obj
Tuesday, February 07, 2012 09:30 AM <dir> Properties
Wednesday, February 08, 2012 11:06 PM 4,068 AddNumbers.csproj
Wednesday, February 08, 2012 11:06 PM 1,086 AddNumbers.csproj.user
Thursday, February 09, 2012 02:26 PM 58 AddNumbers.Publish.xml
Tuesday, February 07, 2012 09:30 AM 92 Service1.asmx
Thursday, February 09, 2012 10:55 AM 816 Service1.asmx.cs
Tuesday, February 07, 2012 09:30 AM 7,543 Web.config
Tuesday, February 07, 2012 09:30 AM 1,285 Web.Debug.config
Tuesday, February 07, 2012 09:30 AM 1,346 Web.Release.config
BTW: WebMethod is as follows:-
public class Service1 : System.Web.Services.WebService
public Decimal add(Decimal a, Decimal b)
dc = a + b;
N.B. When I Run the Add() Web Service, I must have to keep the "Cursor" of the First Line i.e. front of
using System; using System.Collections.Generic;
Otherwise I get above "Directory Listing " Error.. If I put my Cursot on the Code page, the Web Service Runs alone. But Calling From Client Never Works (After Consuming From Client application)
My Client Call:-
private void button1_Click(object sender, EventArgs e)
Decimal a, b, result;
var client = new WebClientRef.Service1();
a = Convert.ToDecimal(textBox1.Text);
b = Convert.ToDecimal(textBox2.Text);
result = client.add(a, b);
MessageBox.Show("The Total of :" + Convert.ToString(result));
Feb 10, 2012 07:38 PM|LINK
Now right click on serivce1.asmx and then browse.
The url you got try to add that as a reference.