协议“net.tcp”不受支持。

6

我的WCF服务出现了以下错误:"协议 'net.tcp' 不受支持"...

<system.serviceModel>
        <bindings>
      <netTcpBinding>
        <binding name="tcpBinding" transferMode="Streamed" portSharingEnabled="false">
            <reliableSession enabled="true" />
          <security mode="None">
            <transport clientCredentialType="None" protectionLevel="None" />
            <message clientCredentialType="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
        <services>
            <service name="JMSysSplash.CommunicationServer.JMSysSplashServer" behaviorConfiguration="Service1Behavior">
                <endpoint address="" binding="wsHttpBinding" contract="JMSysSplash.CommunicationClient.IJMSysSplashServer">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding"  contract="IMetadataExchange"/>
        <endpoint address="net.tcp://localhost:8888/JMSysSplashServer" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="JMSysSplash.CommunicationClient.IJMSysSplashServer"/>
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8731/JMSysSplashServer.svc/"/>
           <add baseAddress="net.tcp://localhost:8888/JMSysSplashServer"/> 
          </baseAddresses>
                </host>
            </service>
        </services>    
        <behaviors>
            <serviceBehaviors>
                <behavior name="Service1Behavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
4个回答

12
请检查“ .NET 功能 -> WCF 激活 -> 非 HTTP 激活”功能是否已安装(“服务器管理器 -> 添加/删除功能”)。我假设您将服务托管在 IIS 中。在这种情况下,请确保 net.tcp 协议是否允许 Web 站点使用(Web 站点 -> 高级设置 -> 启用协议),并检查是否运行了“Net.Tcp Listner Adapter” Windows 服务。

2

1
我知道这个问题很老并且已经有了答案,但是我遇到了一个类似的问题,解决方法不同。虽然Daniil是正确的,但是如果缺少安装,将会导致相同的错误弹出,我的问题略有不同,并且为了其他人的利益写下这个答案。问题#1:在您的应用程序所在的网站下,在IIS中右键单击并单击“编辑绑定”。确保net.tcp作为绑定之一存在,并将绑定信息设置为“808:*”。问题#2:在IIS中的应用程序节点中,转到其“高级设置”,并检查net.tcp是否在启用的协议列表中。例如,“http,net.tcp”将适用于需要支持后两种协议的情况。希望这可以帮助。

0

您缺少nettcp的基础地址 - 或者您需要在终结点中定义完整的netTCP地址。您当前的netTcp终结点如下:

       <endpoint address="" binding="netTcpBinding" 

您没有指定完整地址 --> WCF正在寻找用于net.tcp的基础地址,但是没有找到! 解决方法1:添加一个用于netTcp的baseAddress
<services>
    <service name="JMSysSplash.CommunicationServer.JMSysSplashServer" behaviorConfiguration="Service1Behavior">
        .....
        <host>
            <baseAddresses>
                <add baseAddress="http://localhost:8731/JMSysSplashServer.svc/"/>
                <add baseAddress="net.tcp://localhost:8888/JMSysSplashServer"/>
            </baseAddresses>
        </host>
    </service>
</services>

现在您的 net.tcp 端点可以通过 net.tcp://localhost:8888/JMSysSplashServer 访问

解决方案2: 在您的 net.Tcp 端点中定义一个完整的地址:

<services>
    <service name="JMSysSplash.CommunicationServer.JMSysSplashServer" 
             behaviorConfiguration="Service1Behavior">
        <endpoint address="" binding="wsHttpBinding" 
                  contract="JMSysSplash.CommunicationClient.IJMSysSplashServer">
            <identity>
                <dns value="localhost"/>
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"  
                  contract="IMetadataExchange"/>
        <endpoint 
             address="net.tcp://localhost:8888/JMSysSplashServer" 
             binding="netTcpBinding" bindingConfiguration="tcpBinding"  
             contract="JMSysSplash.CommunicationClient.IJMSysSplashServer"/>
        .......
    </service>
</services>

当您定义一个终结点时,您可以:

  • 定义一个完整地址(包括net.tcp和端口号等)

或者:

  • 定义一个相对地址(例如,address=""),但是在这种情况下,您必须为该方案(在此处为net.tcp)定义一个基本地址,而不仅仅是http基本地址。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接