2016-10-08 28 views
2

我在使用net.tcp端点启动WCF服务时遇到问题。我收到了10049错误。无法使用net.tcp绑定错误启动服务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(); 

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

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

预先感谢您!

+0

根据例外情况,您在tcp侦听器上发生错误。听众不应该听IP地址。您应该正在监听端点IP.Any。 – jdweng

+0

@jdweng,你能举个例子吗? – kotki

+0

请参阅网页:http://stackoverflow.com/questions/32181993/how-to-create-a-wcf-that-listens-to-tcp-requests-over-web。程序代码可能启动了侦听器。对于套接字代码示例,请参阅以下内容:可以使用任何继承套接字(如TCPListener)而不是套接字的类:https://msdn.microsoft.com/en-us/library/w89fhyex(v=vs.110).aspx – jdweng

回答

3

尝试用

net.tcp://localhost:50050/reg 

与同为/auth端点,以取代线

net.tcp://78.26.210.203:50050/reg