开发者

How to stop WCF Test Client from randomly start when debugging?

开发者 https://www.devze.com 2023-02-25 04:28 出处:网络
We have a WCF service (setup to use IIS Express in VS2010 SP 1) that we start up for debugging. Most (95%) of the time it will just startup and sit there running/waiting.5% of the time though it will

We have a WCF service (setup to use IIS Express in VS2010 SP 1) that we start up for debugging.

Most (95%) of the time it will just startup and sit there running/waiting. 5% of the time though it will decide to start the WCF Test Client which if you close ends the service.

开发者_运维知识库

Is there anything we can do so the test client doesn't load ever? It's a bit annoying..


This happens if you start the application when working on the service (service is your active opened file).


If you want to use an .svc file as the start page, but don't want the WCF Test Client to pop up when you run your project, you can:

right click project -> unload project

right click project -> edit project.csproj

add the following (or set it to False if it already exists):

<EnableWcfTestClientForSVCDefaultValue>False</EnableWcfTestClientForSVCDefaultValue>

within:

<ProjectExtensions>
  <VisualStudio>
    <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f22}">
      <WebProjectProperties>
        ...
        <EnableWcfTestClientForSVCDefaultValue>False</EnableWcfTestClientForSVCDefaultValue>
      </WebProjectProperties>
    </FlavorProperties>
  </VisualStudio>
</ProjectExtensions>

Then obviously set your start page to your .svc file. If that still brings up the WCF Test Client, make sure there isn't a setting overriding it within the .csproj.user file, like so:

<EnableWcfTestClientForSVC>True</EnableWcfTestClientForSVC>

(Or you can set this field to false in .csproj.user instead of setting the other one in the .csproj file. That way, you don't force the same setting for other developers, whichever works for you).

I have confirmed this works with Visual Studio 2010 and 2012.


In my experience, if the startup project is the WCF Service project AND you have set a .svc file as the start page, you get the WCF test client when starting debugging.

If you don't have a start page, the WCF test client is not automatically launched.


Its caused your actual context in solution items in moment of launching.
You can fix this issue with setting StartAction for your WCF service project.

Right click on your WCF project in solution overview -> Properties -> Web -> StartAction
I'm using opinion "Specific page" and setting it to Default.aspx
If you let it as "CurentPage" then if you are launching your project while previewing some .svc file, WCF Test client will be launched

0

精彩评论

暂无评论...
验证码 换一张
取 消