簡體   English   中英

找不到與綁定 NetTcpBinding 的端點的方案 net.tcp 匹配的基地址。 基地址方案是 [http]

[英]Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Base address schemes are [http]

我的 WCF 服務有這個配置,它在 IIS Express 端口號 50187 上運行。該服務托管在 Visual Studio 2017 的 IIS Express 上:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="QCConsumerBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="50000000" maxBufferPoolSize="5242880" maxReceivedMessageSize="50000000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="QCWCFService.QCService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="QCConsumerBinding" contract="QCWCFService.IQCService" />
      </service>
      <service name="QCWCFService.QCFinalService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="QCConsumerBinding" contract="QCWCFService.IQCFinalService" />
      </service>

      <service name="QCWCFService.CalibrationService">
        <endpoint address="service" binding="netTcpBinding" contract="QCWCFService.ICalibrationService" />
        <endpoint address="" binding="wsDualHttpBinding" contract="QCWCFService.ICalibrationService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8080/CalibrationService" />
            <add baseAddress="http://localhost:8081/CalibrationService" />
          </baseAddresses>

        </host>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>          
          <!-- To avoid disclosing metadata information, set the values below to false 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="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add scheme="http" binding="wsDualHttpBinding" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

但是當我嘗試運行該服務時,它給出了這個異常:

System.InvalidOperationException: Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

雖然我有另一個具有相同配置的雙 Http 綁定應用程序,但它運行良好

默認情況下,IIS express 不支持Net.tcp協議。 具有Nettcpbinding的服務端點需要一個基於NetTcp協議的基地址。

<endpoint address="service" binding="netTcpBinding" contract="QCWCFService.ICalibrationService" />

盡管我們使用Host Section提供了Nettcp基址,但它不起作用。 這是因為 IIS express 使用自配置來提供基​​地址來運行當前項目。 IIS express 的配置通常位於當前解決方案的 .vs 文件夾中,稱為applicationhost.config
在此處輸入圖片說明
如果我們在具有此配置的控制台應用程序中運行此項目,它將起作用。 因此我們應該為 Nettcp 協議提供一個基地址。 這可以在 IIS 中完成。
1. 啟用net.tcp協議的 windows 功能。
在此處輸入圖片說明
2.增加網站對Net.tcp支持。
在此處輸入圖片說明
3.在site binding module添加net.tcp協議。
在此處輸入圖片說明
請參閱以下有關將net.tcp協議添加到網站的詳細信息。
啟用可靠會話時 WCF ContractFilter 不匹配
如果問題仍然存在,請隨時告訴我。

暫無
暫無

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

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