簡體   English   中英

不支持協議“net.tcp”

[英]Protocol 'net.tcp' is not supported

我正在將我的 wcf 托管從 Windows 服務更改為托管在 IIS 中。

我在我的解決方案中添加了 wcf 服務應用程序,並添加了對我的項目的引用並將 svc 文件編輯為此

<%@ ServiceHost Language="C#" Debug="true"
Service="EFG.Acc.CashService.ServiceFactory.CashService" %>

然后我配置了web.config並定義了綁定,這些綁定將是 netTcp 綁定和端點。

我已啟用我的 IIS 網站設置以啟用協議到 http.nettcp 和相同的異常。

瀏覽我的 service.svc 文件時遇到此異常:

**protocol 'net.tcp' is not supported. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.InvalidOperationException: The protocol 'net.tcp' is not supported.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
Stack Trace: 
[InvalidOperationException: The protocol 'net.tcp' is not supported.]
   System.ServiceModel.Activation.HostedTransportConfigurationManager.InternalGetConfiguration(String scheme) +98668
   System.ServiceModel.Activation.HostedAspNetEnvironment.GetBaseUri(String transportScheme, Uri listenUri) +24
   System.ServiceModel.Channels.TransportChannelListener.OnOpening() +12200164
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +274
   System.ServiceModel.Channels.DelegatingChannelListener`1.OnOpen(TimeSpan timeout) +112
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318
   System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +72**

這是我的 Web.config 文件

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="false" targetFramework="4.0" />
  </system.web>

  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding"
                 transactionFlow="true"
                 listenBacklog="100"
                 maxConnections="5000"/>
      </netTcpBinding>
    </bindings>
    <services>
      <service name="EFG.Acc.CashService.ServiceFactory.CashService">
        <endpoint address="net.tcp://localhost:8000" binding="netTcpBinding"
          bindingConfiguration="NetTcpBinding" name="netTcpEndPoint" bindingName="CashServiceTCP"
          contract="EFG.Acc.CashService.Contracts.Interfaces.ICashService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:7000"/>

          </baseAddresses>
        </host>

      </service>
    </services>
    <protocolMapping>
      <add scheme="net.tcp" binding="netTcpBinding" bindingConfiguration="NetTcpBinding"/>
    </protocolMapping>
    <behaviors>
      <serviceBehaviors>
        <behavior>
           <!--To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment--> 
          <serviceMetadata httpGetEnabled="true"/>
           <!--To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information--> 
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <client>
      <endpoint address="net.tcp://localhost:8000/CashService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" contract="EFG.Acc.CashService.Contracts.Interfaces.ICashService" name="CashServiceTCP2" />
    </client>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

嘗試仔細閱讀: http : //blogs.msdn.com/b/james_osbornes_blog/archive/2010/12/07/hosting-in-iis-using-nettcpbinding.aspx

+

  • 您正在使用 nettcpbinding 和 http baseAddress

  • 測試時添加元數據端點

  • 我多次使用 nettcp 與 IIS 綁定,每次都沒有“protocolMapping”

  • 我建議只在 baseAddress 中使用絕對地址(匹配協議 net.tcp://!)和相對地址 - 在端點地址中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM