Disabling the Visual Studio Service Host



When debugging a WCF project in Visual Studio the WCF Service Host starts up to host my service. How do I stop this from happening so that I can use my own service host?

One of the new tools in Orcas is the WCF Service Host that allows you to automatically host and test a service that you've implemented. The WCF Service Host comes along with some of the specialized WCF project templates in Visual Studio, such as WCF Service Library and Syndication Service Library.

If you've picked one of these project templates, then I don't know of a good way of disabling the service host. This should be fixed in SP1 by adding some user interface to toggle the service host on and off. In the meantime, you can perform some surgery on the project file to work around this. If you look inside the actual csproj file for your project, then you'll see a PropertyGroup section that defines the project.

  <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3CC71D2E-7EC2-46B5-B985-F889B65E3DCD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WcfServiceLibrary1</RootNamespace>
<AssemblyName>WcfServiceLibrary1</AssemblyName>
<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<StartArguments>/client:"WcfTestClient.exe"</StartArguments>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>

The ProjectTypeGuids list is what controls these special features of projects. Removing the {3D9AD99F-2412-4246-B90B-4EAA41C64699} entry from the list will disable automatic service hosting.

Next time: Debugging Type Loading

Comments (11)
  1. barryd says:

    Or you could take the quick and dirty route; rename the app.config file in the project – no more service host, and it’s easy to swap back should you need it again.

  2. What’s the difference between the Name and ConfigurationName on service contracts and behaviors? The

  3. Via this post . If you haven&#39;t experienced it yet, there&#39;s a project template for WCF in VS2008

  4. One of the new and very annoying feature of Visual Studio 2008 is the WCF service host : Windows Communication

  5. My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Microsoft Downloads: Visual Studio Team System 2008 Capabilities White Papers . Symbols Package for Windows XP Service Pack 3 . Via

  6. General Disabling the Visual Studio Service Host : A new feature in Visual Studio 2008 is the WCF service host – similar to the web development server, but for WCF services. At times, this is handy…all other times, it’s obnoxious. Nicholas Allen has

  7. Hi Nicholas,

    I made a comment on how to do the direct opposite some time back;

    http://sral.org/blogs/larsw/archive/2007/10/26/upgrade-a-visual-studio-2008-class-library-project-to-support-the-wcf-test-client.aspx

    In the SP1 beta, it is not enough to just remove the ProjectGuid to disable the automatic hosting of the WCF Service.

    Now, on the Startup Project option page (for the Solution) it is now possible to set "Current Selection", that is – if you have a file selected in a project, it will use that one as the startup project.

    To get rid of the auto hosting feature, I also removed this section from the bottom of the project file:

    <ProjectExtensions>

       <VisualStudio>

         <FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">

           <WcfProjectProperties>

             <AutoStart>True</AutoStart>

           </WcfProjectProperties>

         </FlavorProperties>

       </VisualStudio>

     </ProjectExtensions>

    Regards,

    Lars Wilhelmsen

  8. VS2008: Disabilitare l’host di WCF

  9. When we create a WCF application using some of the built-in WCF project templates (such as WCF Service

  10. Via this post . If you haven&#39;t experienced it yet, there&#39;s a project template for WCF in VS2008

  11. General Disabling the Visual Studio Service Host : A new feature in Visual Studio 2008 is the WCF service host – similar to the web development server, but for WCF services. At times, this is handy…all other times, it’s obnoxious. Nicholas Allen has

Comments are closed.

Skip to main content