none
Self hosted WCF named pipe service, called from another WCF service RRS feed

  • Question

  • 
    


    Hi there,

    For a proof off concept I was experimenting with a self hosted WCF service, to some share code. Using named pipes this works fine for regular client, but when I call the self hosted service from another (IIS) WCF service (within the same solution), I get the exception:

    "{"Could not find a base address that matches scheme net.pipe for the endpoint with binding NetNamedPipeBinding. Registered base address schemes are []."}"

    I created a small test app, with these two services and call both from a console app:

    			Console.WriteLine( "Normal webservice call...");
    			var ws = new WebServiceClient();
    			var resultWs = ws.GetData(100); // OK
    			Console.WriteLine( "Normal WS call result : " + resultWs);
    
    			Console.WriteLine( "Named pipe call from client...");
    			var resultNp = SharedCode.Gateway.Service.GetData(99); //OK
    			Console.WriteLine("NamedPipe call result : " + resultNp);
    
    			Console.WriteLine("Named pipe call via webservice...");
    			resultWs = ws.GetDataViaGateway(88); // NOT OK - BOOM
    			Console.WriteLine("Normal WS call result : " + resultWs);

    where the webservice call "ws.GetDataViaGateway(88)" is calling the same code as the direct call "SharedCode.Gateway.Service.GetData(...)".

    The config of the console app:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
      </startup>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_IWebService" />
          </basicHttpBinding>
          <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_IGatewayService" />
          </netNamedPipeBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="ServiceBehavior">
              <serviceMetadata httpGetEnabled="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <client>
          <endpoint address="http://localhost:5582/WebService.svc" binding="basicHttpBinding"
              bindingConfiguration="BasicHttpBinding_IWebService" contract="WebServiceProxy.IWebService"
              name="BasicHttpBinding_IWebService" />
    
          <endpoint address="net.pipe://localhost/Gateway" binding="netNamedPipeBinding"
                    bindingConfiguration="NetNamedPipeBinding_IGatewayService"
                    contract="GatewayProxy.IGatewayService" name="NetNamedPipeBinding_IGatewayService" />
        </client>
        <services>
          <service name="Gateway.GatewayService" behaviorConfiguration="ServiceBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="net.pipe://localhost/Gateway" />
              </baseAddresses>
            </host>
            <endpoint address="" binding="netNamedPipeBinding" contract="Gateway.IGatewayService"/>
          </service>
        </services>
      </system.serviceModel>
    </configuration>
    


    The config of the WCF service which is calling the self hosted service is:

    <?xml version="1.0"?>
    <configuration>
      <appSettings/>
      <system.web>
        <compilation defaultLanguage="c#" debug="true" targetFramework="4.0">
          <buildProviders>
            <add extension=".rem" type="System.Web.Compilation.WebServiceBuildProvider"/>
          </buildProviders>
        </compilation>
        <httpRuntime maxRequestLength="1048576" executionTimeout="1200"/>
        <customErrors mode="Off"/>
        <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
      </system.web>
      <system.serviceModel>
        <bindings>
          <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_IGatewayService" />
          </netNamedPipeBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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>
            <behavior name="ServiceBehavior">
              <serviceMetadata httpGetEnabled="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <client>
          <endpoint address="net.pipe://localhost/Gateway"
              binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IGatewayService"
              contract="GatewayProxy.IGatewayService" name="NetNamedPipeBinding_IGatewayService" />
        </client>
        <services>
          <service name="Gateway.GatewayService" behaviorConfiguration="ServiceBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="net.pipe://localhost/Gateway" />
              </baseAddresses>
            </host>
            <endpoint address="" binding="netNamedPipeBinding" contract="Gateway.IGatewayService"/>
          </service>
        </services>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>
    </configuration>

    Anyone any idea how to make the regular WCF service call the selfhosted services without errors?

    Thursday, January 2, 2014 8:07 AM

Answers

  • Hi,

    >>Could not find a base address that matches scheme net.pipe for the endpoint with binding NetNamedPipeBinding. Registered base address schemes are

    Since your wcf service which uses the named pipes works fine for regular client, so I think your service code is correct. It should be something wrong with the IIS host services.

    I saw that you used the NetNamedPipeBinding with the IIS. But by default only the http binding can be used in the IIS hosting. So in order to get Named pipes to work on IIS, we must enable Windows Process Activation Service (WAS) on IIS and configure the site that we are using to allow named pipes.

    For details information, please try to check:
    #Hosting WCF service netNamedPipeBinding in IIS:
    http://dotnetmentors.com/hosting-wcf-service-with-nettcpbinding-or-netnamedpipebinding-in-iis.aspx .

    Best Regards,
    Amy Peng



    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, January 3, 2014 2:35 AM
    Moderator