无法使用net.tcp绑定错误10049启动服务

时间:2016-10-08 12:11:49

标签: c# .net wcf tcp

我在使用net.tcp端点启动WCF服务时遇到问题。我收到10049错误。

我的app.config

<system.serviceModel>
    <services>
        <service behaviorConfiguration="ServiceBehaviour0"
                 name="Tinkl.Server.Services.Authentication.AuthenticationService">
            <endpoint name="httpEndpoint"  
                address="reg"
                binding="basicHttpBinding"
                contract="Tinkl.Server.Services.Authentication.IRegistrationService" />
           <endpoint name="httpEndpoint" 
               address="auth"
               binding="basicHttpBinding"
               contract="Tinkl.Server.Services.Authentication.IAuthorizationService" />
           <!--
           <endpoint name="tcpEndpoint" 
               address="net.tcp://78.26.210.203:50050/reg"
               binding="netTcpBinding"
               contract="Tinkl.Server.Services.Authentication.IRegistrationService" />
           <endpoint name="tcpEndpoint"
               address="net.tcp://78.26.210.203:50051/auth"
               binding="netTcpBinding"
               contract="Tinkl.Server.Services.Authentication.IAuthorizationService" />
               -->
           <endpoint name="mexEndpoint"
               address="mex"
               binding="mexHttpBinding" bindingConfiguration=""
               contract="IMetadataExchange" />
           <host>
               <baseAddresses>
                   <add baseAddress="http://78.26.210.203:50076/" />
               </baseAddresses>
           </host>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceBehaviour0">
                <!--<serviceMetadata />-->
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="True" />
            </behavior>
        </serviceBehaviors>
    </behaviors>

有2个端点netTcpBinding,2个端点与basicHttpBinding完全相同。

当我尝试使用netTcpBinding个端点时出现问题,我收到错误,但使用basicHttpBinding时效果很好......

enter image description here

我正在控制台应用程序中托管WCF服务。

程序代码

ServiceHost authenticationHost = new ServiceHost(typeof(AuthenticationService));
authenticationHost.Open();

Console.WriteLine("close <ENTER>\n");

Console.ReadLine();
authenticationHost.Close();

也许有人遇到过类似的问题?

如果需要,我会提供所有必要的额外信息

提前谢谢!

1 个答案:

答案 0 :(得分:3)

尝试替换行

net.tcp://78.26.210.203:50050/reg

net.tcp://localhost:50050/reg

/auth端点也一样。