简体   繁体   中英

Configure WCF as Named Pipe hosted on IIS7

I have two different WCF services hosted on IIS7. One is Database Service which is configured to run on namedpipe. The other service hosted on same machine is accessing the first service via named pipe and is configured to run on webhttp.

however when i call the database service from another service i get the following error

"There was no endpoint listening at "net.pipe://localhost/iSPYDBService" that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

Database Service Config file Snippet

<system.serviceModel>
<services>
  <service name="DBService.Service">
    <endpoint address="net.pipe://localhost/iSPYDBService" 
              binding="netNamedPipeBinding" 
              contract="DBService.Contracts.IDBService"  
              bindingConfiguration="Binding1" />
  </service>
</services>
<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>
  </serviceBehaviors>
</behaviors>
<protocolMapping>
  <add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>

<bindings>
  <netNamedPipeBinding>
    <binding name="Binding1"                 
             closeTimeout="00:01:00"
             openTimeout="00:01:00"
             receiveTimeout="00:10:00"
             sendTimeout="00:01:00"
             transactionFlow="false"
             transferMode="Buffered"
             maxBufferPoolSize="524288"
             maxBufferSize="65536"
             maxConnections="10"
             maxReceivedMessageSize="65536">
      <security mode="Transport">
        <transport protectionLevel="EncryptAndSign" />
      </security>
    </binding>
  </netNamedPipeBinding>
</bindings>    
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

The Other Service Calling the Database service via named pipe throws error as mentioned above.

       ChannelFactory<DBService.Contracts.IDBService> pipeFactory =
                new ChannelFactory<DBService.Contracts.IDBService>(
            new NetNamedPipeBinding(),
            new EndpointAddress("net.pipe://localhost/iSPYDBService"));

        pipeProxy = pipeFactory.CreateChannel();

        var categories = pipeProxy.GetCategories();

Both services are hosted on IIS. i have already given the binding for net.pipe in database service and also add "http,net.pipe" in "enabled protocols".

  1. You cannot use IIS Express.

  2. In IIS (full, not express) ... go to your website.

Follow this bread crumb:

WCF Host Web Site > Manage Application > advanced Settings > Enabled Protocols

You probably have "http" or "http,net.tcp" already set.

Add "net.pipe" (with a comma before it)

As seen below. Note, do not add any spaces.

http,net.tcp,net.pipe

The magic is the correct value ("net.pipe") in this case.

You can read more about it here

Could not find a base address that matches scheme net.tcp

The following should help:

  1. Clear the address in the service config like address=""
  2. Edit the bindings of your site in IIS and add or update the site bindings of the net.pipe type and give the "Binding information" a proper name
  3. Update your client config to address="net.pipe://PROPER_NAME/YOUR_SERVICE.svc"
  4. Set the security mode to None for the bindings on both the client and the service end.
  5. Make sure the Windows Features are enabled for Named Pipe Activation for WCF 4.5 or the Non-HTTP Activation for WCF 3.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM