对于绑定NetTcpBinding的端点,找不到与方案net.tcp匹配的基地址。基址方案为[http]

问题描述 投票:1回答:1

我具有在IIS Express端口号50187上运行的WCF服务的此配置。该服务托管在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绑定应用程序,但效果很好

c# wcf wcf-binding
1个回答
0
投票

默认情况下,IIS Express不支持Net.tcp协议。具有Nettcpbinding的服务端点需要基于NetTcp协议的基址。

<endpoint address="service" binding="netTcpBinding" contract="QCWCFService.ICalibrationService" />
© www.soinside.com 2019 - 2024. All rights reserved.