none
Problemas de Conexao Windows Service Host com TCP RRS feed

  • Pergunta

  • Server 

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
     <system.serviceModel>
      <services>
       <service name="Business.Blog.BlogPalavraBloqueadaBusiness" behaviorConfiguration="BlogPalavraBloqueadaServiceBehavior">
        <endpoint address="Blog" binding="netTcpBinding" bindingConfiguration="" contract="Contracts.Blog.BlogPalavraBloqueadaServiceContract" />
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
        <host>
         <baseAddresses>
          <add baseAddress="http://100.120.126.190:8000" />
          <add baseAddress="net.tcp://100.120.126.190:9001" />
         </baseAddresses>
        </host>
       </service>
      </services>
      <behaviors>
       <serviceBehaviors>
        <behavior name="BlogPalavraBloqueadaServiceBehavior">
         <serviceMetadata httpGetEnabled="True" />
         <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
       </serviceBehaviors>
      </behaviors>
     </system.serviceModel>
    </configuration>
    
    

     Client

     <system.serviceModel>
      <client>
       <endpoint address="net.tcp://100.120.126.190:9001/Blog" binding="netTcpBinding" bindingConfiguration=""
            contract="Contracts.Blog.BlogPalavraBloqueadaServiceContract" name="NetTcpBinding">
       </endpoint>
      </client>
     </system.serviceModel>
    

     

    Program.cs

    using (var host = new ServiceHost(typeof(BlogPalavraBloqueadaBusiness)))
    {
      host.Opening += (obj, e) => Console.WriteLine("Iniciando servidor...");
      host.Opened += (obj, e) => Console.WriteLine("Servidor iniciado.");
    
      host.Open();
    }
    
    Console.ReadKey();
    

    Ok. Servidor Iniciado.

    var result = client.Selecionar();

    Erro:

    Não foi possível a conexão com net.tcp://100.120.126.190:9001/Blog. A tentativa de conexão durou pelo período de tempo de 00:00:01.1273472. Código de erro TCP 10061: Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente 100.120.126.190:9001.


    Marcel Piva
    terça-feira, 27 de julho de 2010 21:13

Respostas

Todas as Respostas