【问题标题】:Unable to automatically step into the server when debugging WCF调试 WCF 时无法自动步入服务器
【发布时间】:2017-03-03 04:37:51
【问题描述】:

我得到了可怕的:

无法自动进入服务器。无法调试远程过程。这通常表示服务器上尚未启用调试。"

现在,我一直在阅读我需要添加的内容

<compilation debug="true">

到 web.config 。

很公平,我的问题是我的 WCF 服务是托管在 Windows 进程中的 nettcp 绑定。

我在哪里添加这个?在windows服务的app.config中托管WCF服务?

在哪个部分?现在我的 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>

【问题讨论】:

    标签: .net wcf debugging


    【解决方案1】:

    首先,我在 Visual Studio 2015 中遇到了这个问题。

    如果您在调用 WCF 服务的行上添加断点并在调试时按 F11 进入 WCF 代码,请注意您必须在您正在调用的 WCF 服务的第一行添加断点。

    【讨论】:

    • 您,先生,是个明星。我试图附加到在 Visual Studio 2013 的第二个实例中运行的旧 asmx Web 服务时发疯了。同样的问题,就我而言,Visual Studio 的两个实例都是 2013 年)。
    【解决方案2】:

    我也遇到了同样的问题。为了能够调试 WCF 服务,您应该在服务器的配置文件中的 &lt;system.web&gt; 部分中添加 &lt;compilation debug="true"&gt; 行。

    更多详情,请查看以下链接: http://msdn.microsoft.com/en-us/library/bb157687.aspx

    【讨论】:

    • "在服务器的配置文件中添加该部分。" - 我仍然不太确定该怎么做。你写在这里是什么意思?
    【解决方案3】:
    <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>
    

    【讨论】:

      【解决方案4】:

      刚刚找到一个可能的解决方案。按照本文http://msdn.microsoft.com/en-us/library/bb157687.aspx 中的说明修复安装。 (重新)安装 VS SP1 也可以解决问题。

      【讨论】:

        【解决方案5】:

        我遇到了同样的问题。 当我检查时,我的服务项目是使用 .NET Framework 4.5 构建的,而客户端项目在 .NET Framework 4.0 上

        我将服务项目的项目属性更改为具有 .NET Framework 4.0 并且它可以工作。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2023-03-15
          • 1970-01-01
          • 2014-05-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多