0
votes

I am trying to follow a textbook learning how to create a web-sentric WCF service project. I created the service, and see the corresponding folder under Default Web Site on IIS. I can even browse the folder (localhost/EmployeeService/) and see the contents in the browser. Now I want to make a client, i.e. a simple Console application. When I am trying to add a Service Reference, after I enter the address, I get an error:

There was an error downloading 'http://localhost/EmployeeService/$metadata'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http://localhost/EmployeeService/'. The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed.

Could you please explain? I saw some questions about the same error, but could not find a solution for myself.

Thanks.

1

1 Answers

1
votes

In order to invoke the service, you must point at the service file. Otherwise the web server doesn't know what you're trying to do.

Add the .svc file to your URL to do that, so http://localhost/EmployeeService/YourService.svc.

You can also have it fileless, see How can I host a WCF service without an SVC file in IIS.