title: WCF – netNamedPipeBinding, basicHttpBinding and IIS interaction
body: <p>I'm trying to populate a method named getData() via the web service PasarelaService over IIS and WCF. At the same time, this service gets the data from a method named getDato(), via named pipe, inside a self-hosted independent-process named Multiplexor. All works fine, except when I call PasarelaService from IIS. </p>
  
  <p>When I test the service with WcfTestClient,  directly from </p>
  
  <pre><code>http://localhost:49208/PasarelaService.svc
  </code></pre>
  
  <p>, avoiding IIS, all works fine and correct value is taken from Multiplexor, but when I test the same service via IIS, from </p>
  
  <pre><code>http://localhost:8001/PasarelaService.svc?wsdl
  </code></pre>
  
  <p>ever returns zero.</p>
  
  <p>It seems that when I call the service in the first mode, a new instance of PasarelaService is created and the execution thread runs over the constructor and then over GetData(). But when I call the service from IIS, perhaps no instance is created and no constructor nor Initconexion() is executed. Only GetData() method is called but returns zero with no errors. I don't know why. </p>
  
  <p>Pasarela code:</p>
  
  <pre><code>Imports Multiplexor
  
  &lt;ServiceBehavior(InstanceContextMode:=InstanceContextMode.Single)&gt; _
  Public Class PasarelaService
  Implements IPasarelaService
  
  ' dato que suministramos al consumidor web
  Private count As Integer
  
  Dim proxy As IServiciosScreen = Nothing
  
  Public Sub New()
      count = 0
      Me.InitConexion()
  End Sub
  
  Private Sub InitConexion()
      Try
          Dim ep As New EndpointAddress("net.pipe://localhost/8100")
          proxy = ChannelFactory(Of IServiciosScreen).CreateChannel(New     NetNamedPipeBinding(), ep)
      Catch ex As Exception
          Debug.WriteLine(ex.ToString)
      End Try
  End Sub
  
  Public Function GetData() As String Implements IPasarelaService.GetData
      Try
          count = proxy.GetDato()
      Catch ex As Exception
          Debug.WriteLine(ex.ToString)
      End Try
  
      Return count.ToString()
  End Function
  
  End Class
  </code></pre>
  
  <p>Rellevant web.config from PasarelaService.</p>
  
  <pre><code> &lt;system.serviceModel&gt;
  &lt;bindings /&gt;
  &lt;services&gt;
    &lt;service name="Pasarela.PasarelaService" behaviorConfiguration="Pasarela.PasarelaServiceBehavior"&gt;
      &lt;!-- Service Endpoints --&gt;
      &lt;endpoint address="" binding="basicHttpBinding" contract="Pasarela.IPasarelaService"&gt;
        &lt;!--
            Antes de la implementación, se debe quitar o reemplazar el siguiente elemento de identidad para reflejar la 
            identidad bajo la que funciona el servicio implementado. Si se quita, WCF deducirá automáticamente una identidad 
            apropiada.
        --&gt;
        &lt;identity&gt;
          &lt;dns value="localhost"/&gt;
        &lt;/identity&gt;
      &lt;/endpoint&gt;
      &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="Pasarela.PasarelaServiceBehavior"&gt;
        &lt;!-- Para evitar revelar información de los metadatos, establezca el valor siguiente en false antes de la implementación --&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;!-- Para recibir detalles de las excepciones en los fallos, con el fin de poder realizar la depuración, establezca el valor siguiente en true. Para no revelar información sobre las excepciones, establézcalo en false antes de la implementación --&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p></p>
  
  <p></p>