How to add service reference in client project?

Silverlight Student picture Silverlight Student · Jun 30, 2011 · Viewed 13.5k times · Source

I am totally new to WCF so please indicate if you find something that I am doing totally wrong here. I have created a WCF service project (my service class is dervied from ServiceBase class) with endpoint address binding set to basicHttpBinding. Now I need to create a client application that can call some APIs from this service. My quesion is that in my client application how can I add service reference to that service. Do I need to publish this service first under IIS (which mean I have to have IIS available on the machine too) or is there some other way of adding service reference too.

Answer

Reed Copsey picture Reed Copsey · Jun 30, 2011

You need something to be running the service, with the metadata being published. This can be IIS, but also any other valid hosting option.

I often write a simple console application to self-host a WCF service, exactly for this reason. It makes it super easy to debug, as well as to update service references during the earlier phases of development, and can dramatically simplify work when working on the client and server simultaneously.