I am attempting to test a WCF web service I’m developing by accessing it using a Winforms client in Visual Studio. The WCF service is being hosted by the Visual Studio ASP.NET development server, and I can see it when I access it via my web browser (it gives me the “You’ve created a service.” page). However, when I attempt to connect to it through the Winforms client (which is configured to point to my local service), it says:
There was no endpoint listening at http://localhost:8181/{Web Application}/{SVC File}.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
There is no value in InnerException. {Web Application} and {SVC File} are actually populated with the correct values, I just removed them from the exception message.
Any ideas as to why this isn’t working and how I can correct it?
First, you need to use local IIS rather than the ASP.NET development server, which is a good habit. Once you do this, make sure you have anonymous granted with permission for the new Web application.
Second, add the web service as a Service Reference.
Third, I used this snippet to test a web service under the above circumstances: