开发者

The protocol 'net.tcp' is not supported

开发者 https://www.devze.com 2022-12-19 00:58 出处:网络
My WCFservice is giving me \"The protocol \'net.tcp\' is not supported\"... <system.serviceModel>

My WCFservice is giving me "The protocol 'net.tcp' is not supported"...

<system.serviceModel>
        <bindings>
      <netTcpBinding>
        <bi开发者_如何学Gonding 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>


Please check that ".NET Features -> WCF Activation -> Non-HTTP activation" feature is installed("server manager -> add/remove features"). And I assume, that you host the service in IIS. In this case, please also check if net.tcp protocol is allowed for a web site(Web Site -> Advanced Settings -> Enabled Protocols) and "Net.Tcp Listner Adapter" windows service is running.


You don't mention who is the host. If you are using IISExpress to host, note that it does not support net.tcp. From http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-faq:
Q: Are WCF applications supported?

A: Yes, IIS Express support WCF applications. As noted above, WCF is only supported over HTTP or HTTPS. WCF over MSMQ and net.tcp is not supported.


I know this is old and answered, but I faced a similar problem with a different resolution.

Although Daniil is correct, missing that installation will cause the same error to pop-up my problem was a little different and writing this answer down for others benefit.

Issue#1 In IIS in the website under which your application resides, right-click and click on "Edit Bindings".

Make sure net.tcp is present as one of the bindings with binding information set to "808:*".

Issue#2 In your application node in IIS, go to its "Advanced Settings" and check if net.tcp is in the enabled protocols list. e.g. "http,net.tcp" would work if you need to support both of the latter protocols.

Hope this helps.


You are missing a base address for nettcp - or then you need to define a full netTCP address in your endpoint. Your current netTcp endpoint looks like this:

       <endpoint address="" binding="netTcpBinding" 

You don't specify a full address --> WCF is looking for a base address for net.tcp to use - but there is none!

Solution 1: add a baseAddress for netTcp:

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

Now your net.tcp endpoint can be reached at net.tcp://localhost:8888/JMSysSplashServer

Solution 2: define a full address in your net.Tcp endpoint:

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

When you define an endpoint, you

  • either define a full address (with net.tcp and port number and all)

OR:

  • you define a relative address (e.g. address="") but in this case, you must have a base address for that scheme (here: net.tcp) - not just a http base address
0

精彩评论

暂无评论...
验证码 换一张
取 消