Unable to automatically step into the server when debugging WCF

半城伤御伤魂 提交于 2020-01-13 08:20:17

问题


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 .

Fair enough, my problem is that my WCF service is a nettcp binding hosted in a windows process.

Where do I add this? In the app.config of the windows service hostiung the WCF service?

In what section? Right now my app.config for the Windows Service Host looks like this :

<?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>

回答1:


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.

For more details, please check the link: http://msdn.microsoft.com/en-us/library/bb157687.aspx




回答2:


First of all, I have this problem in 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.




回答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:


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.




回答5:


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

I changed the project properties of service project to have .NET Framework 4.0 and it worked.



来源:https://stackoverflow.com/questions/1359288/unable-to-automatically-step-into-the-server-when-debugging-wcf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!