visual-studio 如何防止 Visual Studio 在调试时启动 WcfSvcHost.exe?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/283145/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 09:54:59  来源:igfitidea点击:

How to prevent Visual Studio from launching WcfSvcHost.exe while debugging?

.netwcfvisual-studiovisual-studio-debugging

提问by Morgan Cheng

I have a solution in Visual Studio 2008 which has multiple projects. One of the projects is a WCF project. Sometimes I just want to debug other projects, but when I press F5, Visual Studio has wcfsvchost.exe launched to host the WCF project even it is not "StartUp Project".

我在 Visual Studio 2008 中有一个解决方案,它有多个项目。其中一个项目是 WCF 项目。有时我只想调试其他项目,但是当我按 F5 时,Visual Studio 启动了 wcfsvchost.exe 来托管 WCF 项目,即使它不是“启动项目”。

Currently, every time I debugging other projects, I Have to Unload the WCF project to prevent the annoying WcfSvcHost.exe host pop up. However, it is not convenient. Anybody know better idea to prevent WCF project to be hosted in debugging mode?

目前,每次调试其他项目时,我都必须卸载WCF项目以防止弹出烦人的WcfSvcHost.exe主机。然而,这并不方便。有人知道阻止 WCF 项目在调试模式下托管的更好主意吗?

回答by aogan

Go to WCF Options section in the property page of your WCF project and unselect the check box that says 'Start WCF Service Host when debugging another project in the same solution'.

转到 WCF 项目属性页中的 WCF 选项部分,然后取消选中“在同一解决方案中调试另一个项目时启动 WCF 服务主机”复选框。

回答by Damian

If you have created a WCF Project, and then change it to a Console project, and find that the WCF Service Host is still being launched, edit the project and edit the ProjectTypeGuids to remove the WCF Project type:

如果你已经创建了一个WCF Project,然后改成Console项目,发现WCF Service Host还在启动中,编辑该项目,编辑ProjectTypeGuids删除WCF Project类型:

Old:

老的:

<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

New:

新的:

<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

回答by CheGueVerra

You could try to unload the WCF project in the solution, then debug.

您可以尝试卸载解决方案中的 WCF 项目,然后进行调试。

Sorry it was late I misread the last part to fast, then the only other way, that I know of, is to comment out the web parts in the Property Group of the project. This prevented the pop-up for me

抱歉,我太晚了,我误读了最后一部分,然后我所知道的唯一其他方法是注释掉项目属性组中的 Web 部件。这阻止了我的弹出窗口

Unload the project, Comment out the mentioned part, reload.

卸载项目,注释掉提到的部分,重新​​加载。

<!--<PublishUrl>http://localhost/WindowsFormsApplication1/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>true</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>-->

回答by CodingWithSpike

Not sure if this would fix your issue or not, but if you click on the WCF project in solution explorer, see if it has a "Always Start When Debugging" property. If it does, set it to false. That property only shows up for some project types though, so it depends on exactly what type of project template you used.

不确定这是否能解决您的问题,但如果您在解决方案资源管理器中单击 WCF 项目,请查看它是否具有“调试时始终启动”属性。如果是,请将其设置为 false。不过,该属性仅对某些项目类型显示,因此这取决于您使用的项目模板的类型。