How can I disable WcfSvcHost?

When we create a WCF application using some of the built-in WCF project templates (such as WCF Service Library) in Visual Studio 2008, a project type Guid (3D9AD99F-2412-4246-B90B-4EAA41C64699) is added to the PropertyTypeGuids element in the project file. When we debug a project that has this type Guid, Visual Studio runs WcfSvcHost.exe, which auto-hosts our service for debugging and testing purposes.



This is a useful feature if we want to get our service up and running quickly but we really want to use our own host application at some point so we need to be able to disable this functionality (ideally we should be able to switch it on/off). Nicholas Allen wrote a blog entry showing how to do this manually by editing the project file and removing the type Guid mentioned above. He also referred to an upcoming feature in Visual Studio 2008 SP1, which allows us to toggle this setting using the GUI.

So this is how this feature works in Visual Studio 2008 SP1 Beta. In the project properties window, an additional tab called "WCF Options" is displayed for those projects that have the WCF magic type Guid.



This tab has a checkbox entitled "Start WCF Service Host when debugging another project in the same solution" and this item is checked by default. This means Visual Studio will start WcfSvcHost.exe even if we are debugging another (let's say a console) application we want to use as our service host.





If we uncheck this box, WcfSvcHost.exe will be started only if we choose to debug our WCF Service Library project and it will not run when we debug the console application (which is our service host).

This is great as we don't have to edit the project file manually and we can easily switch this feature on/off.

Published Tuesday, May 27, 2008 1:12 PM by Mehran Nikoo
Filed under: ,

Comments

# re: How can I disable WcfSvcHost?

I have done same thing but I am getting below error:

Could not connect to localhost/.../Service1. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8731.

Wednesday, November 12, 2008 5:21 AM by Upen

# re: How can I disable WcfSvcHost?

I think the reason is that your own host application is not listening on the port the client is trying to connect to, which seems to be localhost/.../Service1.

So what I think you need to do is to check the endpoint address on the client and server and make sure they match.

Sunday, December 21, 2008 11:57 PM by Mehran Nikoo

Leave a Comment

(required) 
(required) 
(optional)
(required)