How to add a service link to a client project?

I am completely new to WCF, so please indicate if you have found something that I am doing here is completely wrong. I created a WCF service project (my service class is clouded from the ServiceBase class) with binding to endpoint binding set to basicHttpBinding. Now I need to create a client application that can call some APIs from this service. My question is that in my client application I can add a service link for this service. Do I need to publish this service to IIS first (which means I have to have IIS on my computer) or is there another way to add a link to the service too.

+4
source share
3 answers

You need to start something when the metadata is published. It can be IIS, but any other valid hosting option .

I often write a simple console application for installing the WCF service myself for this reason. This simplifies debugging, and also updates service links at earlier stages of development and can greatly simplify work while interacting with the client and server.

+5
source

You do not need to publish it to IIS, with WCF you can place your device in a console application or a Windows Forms application or as a Windows service or in IIS.

In your client application, you just need to right-click and add a link to the service.

update:
A simple example of WCF

+2
source

Usually you host your WCF service under IIS in your final location (because then it can also determine the URL for you), however you can also just start it directly from visual studio, and then in your client, in Visual Studio, you you can right-click on the "Links" link and select "Add Service Link" and point it to your WCF service, wherever it works.

Then the application will have its own WCF client created for it from WSDL.

Please note that it will also set this URL for the service in your app.config, so if you didn’t have the service hosted in its final URL, you will have to change this URL on the client when you move it to production.

So, to answer your question more directly; yes, your service should work when you add a service link from a client application.

+2
source

All Articles