.net 调试WCF时无法自动步入服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1359288/
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
Unable to automatically step into the server when debugging WCF
提问by Matt
I get the dreaded:
我得到了可怕的:
Unable to automatically step into the server. The remote procedure could not be debugged.This usually indicates that debugging has not been enabled on the server."
无法自动进入服务器。无法调试远程过程。这通常表示尚未在服务器上启用调试。”
Now, I have been reading that I need to add
现在,我一直在阅读我需要添加的内容
<compilation debug="true">
to the web.config .
到 web.config 。
Fair enough, my problem is that my WCF service is a nettcp binding hosted in a windows process.
很公平,我的问题是我的 WCF 服务是托管在 Windows 进程中的 nettcp 绑定。
Where do I add this? In the app.config of the windows service hostiung the WCF service?
我在哪里添加这个?在承载 WCF 服务的 Windows 服务的 app.config 中?
In what section? Right now my app.config for the Windows Service Host looks like this :
在哪个环节?现在,我的 Windows 服务主机的 app.config 如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="Indexer" behaviorConfiguration="IndexerServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Indexer"/>
</baseAddresses>
</host>
<endpoint address="net.tcp://localhost:9000/Indexer"
binding="netTcpBinding"
bindingConfiguration="Binding1"
contract="WCF.IIndexer" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="Binding1"
hostNameComparisonMode="StrongWildcard"
sendTimeout="00:10:00"
maxReceivedMessageSize="65536"
transferMode="Buffered"
portSharingEnabled="false">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="IndexerServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
采纳答案by dann
I have just had the same problem. In order to be able to debug a WCF service, you should add the <compilation debug="true">line in the server's config file inside the <system.web>section.
我刚刚遇到了同样的问题。为了能够调试 WCF 服务,您应该<compilation debug="true">在该<system.web>部分内的服务器配置文件中添加该行。
For more details, please check the link: http://msdn.microsoft.com/en-us/library/bb157687.aspx
更多详情,请查看链接:http: //msdn.microsoft.com/en-us/library/bb157687.aspx
回答by Eikistein
First of all, I have this problem in Visual Studio 2015.
首先,我在 Visual Studio 2015 中遇到了这个问题。
If you add a breakpoint on the line that calls WCF Service and press F11 in debug time to go into the WCF code, be aware you MUST add a breakpoint on the first line of WCF Service you are calling.
如果您在调用 WCF 服务的行上添加断点并在调试时按 F11 进入 WCF 代码,请注意您必须在您调用的 WCF 服务的第一行添加断点。
回答by Ramakrishna Talla
<pre>
Add the below in your server config file
(i) Add below in app.config, if you are hosting your WCF service on windows service.
<system.web>
...
...
...
<compilation debug="true" />
</system.web>
(ii) Add below in web.config, if you are hosting your WCF service on IIS.
<system.web>
...
...
...
<compilation debug="true" />
</system.web>
</pre>
回答by Vikas Kunte
I had the same issue. When i checked, my service project was built using .NET Framework 4.5 where was client project was on .NET Framework 4.0
我遇到过同样的问题。当我检查时,我的服务项目是使用 .NET Framework 4.5 构建的,其中客户端项目在 .NET Framework 4.0 上
I changed the project properties of service project to have .NET Framework 4.0 and it worked.
我将服务项目的项目属性更改为 .NET Framework 4.0 并且它起作用了。
回答by ibrahim
Just found a possible resolution. Repair installation as described in this article http://msdn.microsoft.com/en-us/library/bb157687.aspx. (re)installing the VS SP1 will do the trick too.
刚刚找到了一个可能的解决方案。按照本文http://msdn.microsoft.com/en-us/library/bb157687.aspx 中的说明修复安装。(重新)安装 VS SP1 也能解决问题。

