【问题标题】:IIS WCF net.tcp binding errorIIS WCF net.tcp 绑定错误
【发布时间】:2013-04-20 23:03:33
【问题描述】:

我知道有很多关于这个的问题,我都试过了,但都没有用...... 我在 WS8 上使用 IIS8,将 net.tcp 添加到协议列表并绑定到 808,但我仍然收到此错误:

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://192.168.1.101:64410/eve/relay/ClientRelayService.svc

我正在使用端口 64410 的站点上运行 2 个测试服务(一个是 basichttp,另一个应该是 tcp)。其他服务正在正常工作。

这是我的服务器端配置:

<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <system.web>
        <compilation debug="true" targetFramework="4.0"/>
        <customErrors mode="Off"/>
        <trust level="Full" />
        <httpRuntime/>
    </system.web>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="tcpBinding" transferMode="Streamed" portSharingEnabled="true">
                    <reliableSession enabled="true" />
                    <security mode="None">
                        <transport clientCredentialType="None" protectionLevel="None" />
                        <message clientCredentialType="None" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>

        <services>

            <service name="Eve.API.Services.Relay.RemoteRelayService">
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:64410/eve/relay/" />
                    </baseAddresses>
                </host>
                <endpoint address="" binding="basicHttpBinding" contract="Eve.API.Services.Contracts.Services.Interfaces.IEveAPIService"/>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
            </service>

            <service name="Eve.API.Services.Relay.RelayService">
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:808/eve/relay/ClientRelayService.svc"/>
                    </baseAddresses>
                </host>
                <endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpBinding" contract="Eve.API.Services.Contracts.Services.Interfaces.IRelayService">
                    <identity>
                        <dns value="localhost" />
                    </identity>
                </endpoint>
                <endpoint address="tcpmex" binding="mexTcpBinding" contract="IMetadataExchange"/>
                <!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
            </service>

        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <!-- TODO Set to false on deploy -->
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <protocolMapping>
            <add binding="basicHttpsBinding" scheme="https"/>
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="1" multipleSiteBindingsEnabled="true"/>
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!-- TODO Set to false on deploy -->
        <directoryBrowse enabled="true"/>
    </system.webServer>
</configuration>

【问题讨论】:

  • 您是否尝试过更改 NetTCP 绑定的端口?我不是 100% 确定 http 和 net.tcp 可以通过 IIS 共享同一个端口。

标签: wcf iis wcf-binding invalidoperationexception net.tcp


【解决方案1】:

我会通过 net.tcp 绑定从服务中删除基地址,并在其端点上显式地定义地址,例如

<endpoint address="net.tcp://localhost:808/eve/relay/ClientRelayService.svc" 
  binding="netTcpBinding" bindingConfiguration="tcpBinding" 
  contract="Eve.API.Services.Contracts.Services.Interfaces.IRelayService">

【讨论】:

    猜你喜欢
    • 2011-07-21
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 2015-01-28
    • 2012-08-30
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    相关资源
    最近更新 更多