I'm working through an example on a website to create and consume a WCF service. I've created the service which is hosted in a windows application.
As per the instructions on the site I've created a ClientApp console app within in the same Visual Studio solution. Now the problem is that I cannot create a service reference to the WCF host project.
If I run the host project the Service is switched on and I can verify this by visiting the url in my browser. However, I cannot add a service reference to my client project while another project is running. The "Add Service Reference" option is greyed out. Presumably this is since they're in the same solution in Visual Studio.
If I try and add the reference when the host project is not running then I can get into the "Add Service Reference" screen but no services can be found (presumably because the WCF service is no longer running
How can I get around this?
The solution explorer is as in the image:
In Solution Explorer, right-click the name of the project to which you want to add the service, and then click Add Service Reference. The Add Service Reference dialog box appears. Click Discover. All services (both WCF Data Services and WCF services) in the current solution are added to the Services list.
Select the Build tab; check whether "Any CPU" is selected for Platform Target. In the Solution Explorer, right click on the References folder and click on Add Service Reference. The Add Service Reference wizard will pop up. In the Address section, enter the WCF service URL and then click on Go button.
You could also try to start the WCF service in Visual Studio, then select "Detach All" from the Debug menu. This should let the service continue to run in the background, yet open Visual Studio to let you add service references.
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