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.
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.
You don't have to publish it under IIS, with WCF you can host your sevice in a console application or windows forms app or as Windows service or under IIS.
In your client app you will just need to right click and add service reference.
update:
Simple WCF Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With