2011-07-08 11 views
8

Soy totalmente nuevo e intento alojar el servicio WCF más simple con un enlace net.tcp Tengo Windows 7 Professional e IIS7 y he habilitado la activación NON http.Alojando un servicio WCF con Net.TCP

  • Comienzo una nueva aplicación de servicio WCF proyecto en vs2010 y compilarlo. NOHTING ELSE!
  • elimino toda mi IIS sitios web y añadir una nueva llama WCFHost
  • abro WcfTestClient.exe y añade http://localhost/Service1.svc la aplicación le resulta

El Web.config tiene este aspecto (sin tocar)

<system.serviceModel> 
    <services> 
     <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior"> 
     <endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WcfService2.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

Hasta ahora, todo bien. Pero ¿qué pasa con ese enlace net.tcp? Agrego el atributo "enabledProtocols" así que mi applicationHost.config se parece a esto

 <site name="WCFHOST" id="3"> 
      <application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq"> 
       <virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" /> 
      </application> 
      <bindings> 
       <binding protocol="net.tcp" bindingInformation="808:*" /> 
       <binding protocol="http" bindingInformation="*:80:" /> 
      </bindings> 
     </site> 

Luego voy a la página web de IIS WCFHost y añadir net.tcp unión 808: * Y entonces modificar mi web.config para el Servicio WCF para que se vea así. (Acaba de cambiar la unión en los puntos finales)

<system.serviceModel> 
    <services> 
     <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior"> 
     <!-- Service Endpoints --> 
     <endpoint address="" binding="netTcpBinding" contract="WcfService2.IService1"> 
      <!-- 
       Upon deployment, the following identity element should be removed or replaced to reflect the 
       identity under which the deployed service runs. If removed, WCF will infer an appropriate identity 
       automatically. 
      --> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="WcfService2.Service1Behavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="false"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

Cuando Ahora trato de añadir el servicio net.tcp: // localhost: 808/Service1.svc en mi WcfTestClient.exe consigo el error

Error: No se pueden obtener Metadatos de net.tcp: //localhost/Service1.svc TCP-errorcode 10061: No se pudo establecer ninguna conexión porque la máquina de destino la rechazó activamente ... 127.0.0.1:808

Mi firewall esta apagado. He visto una cosa, sin embargo .. cuando se usa netstat -a el puerto 808 no aparece en la lista ... ¿o sí?

Puede alguien ayudarme a sólo la creación de mi primer servicio WCF con la unión nettcp?

Respuesta

7

Los enlaces net.tcp están habilitados en IIS para las solicitudes en 808? Compruébelo en el administrador/enlaces de IIS.

See it

+0

¡Gracias a un millón! He luchado con esto todo el día :) – Martin

13

Como dice Tocco, compruebe que el servicio se está ejecutando. Usted puede hacer esto mediante la comprobación:

netstat /an | find /i "808 "

y debe mostrar:

TCP 0.0.0.0:808 0.0.0.0:0 LISTENING
TCP [::]:808 [::]:0 LISTENING

si el servicio se está ejecutando correctamente.

para conseguir que se inicia si no está ya trabajando, puede emitir:

sc start NetTcpActivator

desde la línea de comandos para ttry para iniciarlo.

Incluso antes de eso, asegúrese de que the non-HTTP activation windows components are installed.

También compruebe que los servicios se están ejecutando realmente. I had a problem where they would not necessarily start after a reboot.

Cuestiones relacionadas