Reputation: 601
I am trying to debug a WCF project. So can someone tell me a simple way to run this WCF project locally?
I loaded it in Visual Studio and when I tell it to run it says "A project of Output Type Class Library cannot be started." or something like that.
From there I come here, because I've exhausted my knowledge of WCF. Any answers may need to be severely "dumbed down".
Upvotes: 1
Views: 10417
Reputation: 306
Set your WCF Service as Set As Startup Project and RUN project. For testing, best way to check your methods through Postman tool instead of creating client for your WCF Service. You just need to take service URL like "http://localhost:35710/yourservicename.svc" after running your project and use in Postman.
Upvotes: 0
Reputation: 601
Rajput's answer may work, but another developer here showed me an easier way (for me). Our WCF project already has a hosting class (I did not know this). He showed me to set that as the startup project and then start the project. Then a browser window opens. I copy the URL that appears in that browser and paste that URL into the web.config endpoint settings like this:
<endpoint address="http://localhost:44798/ControlService.svc ...
Now I can step into the running code in the WCF project.
Upvotes: 0
Reputation: 2607
This error simply means you have not set any start up project for WCF project. Try to set service host project as start up project if there is any. If you dont have any of them try to make service host project locally and add a reference to that project in your service host project.
A simple console hosting project will look like this
using System.ServiceModel;
namespace WcfDemoHost
{
class Program
{
static void Main(string[] args)
{
try
{
ServiceHost svchost = new ServiceHost(typeof(yourServiceClassNameHere));
svchost.Open();
Console.WriteLine("Service Started");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
there are also several method for hosting WCF services locally like hosting in Windows service, IIS, Console, in windows form etc.You also need to add App.config file for configuring your service like service endpoint and many things. I am providing you some youtube tutorial link that will help you a lot in understanding WCF. I hope this tutorial will help you a lot.
https://www.youtube.com/watch?v=QmfPmqMk9Xs&list=PL6n9fhu94yhVxEyaRMaMN_-qnDdNVGsL1
Go from part 3 and for hosting follow tutorial 24-30.
Upvotes: 5