2

I have two web sites-- one with an aspx file, one with a wcf service with two end points, one http and one named pipes. They both run on the same machine, so they seemed like a candidate for using the net.pipe binding.

The aspx file creates a service client and attempts to call the net.pipe. And I get this:

"Server Error in '/dev' Application.The message could not be dispatched because the service at the endpoint address 'net.pipe://localhost/netNamedPipeBinding' is unavailable for the protocol of the address."

Googling suggest this could be a security problem (no permissions errors are the same as no listener errors), but I've already granted NTFS rights to the [NETWORK] user group to the websites files with the services and no change.

The site with the aspx is using Forms authentication (i.e. not windows auth) and the service website is anonymous auth. The web.config's have the net.pipe security set to ="None"

Locally, this works fine-- although I have to run the named pipes host in a console app since the Visual Studio Dev Server can't do named pipes. Also, the Http endpoint works fine on IIS.

It's running .NET 4.0, IIS 7.5, Win2008.

IIS Config As far as I can tell,

  • net.pipe has been enabled for the service website, with config info of *
  • WAS is installed and enabled, (via windows features)
  • the net.pipe listener Windows service is enabled.
  • Each website is anonymous access (auth is done by a 3rd party single sign on sever)
  • Each website has it's own app pool (probably not relevant)
  • The service site is in web garden mode (probably not relevant)

Service Config (Running on IIS on same machine, different VDIR)

<system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="netNamedPipeBindingConfig" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
            maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport protectionLevel="EncryptAndSign" />
                </security>
            </binding>
        </netNamedPipeBinding>
    </bindings>
    <services>
        <service name="MyService">
            <host>
                <baseAddresses>
                    <add baseAddress="net.pipe://localhost/" />
                </baseAddresses>
            </host>
            <endpoint
                         address="netNamedPipeBinding"
                         bindingConfiguration="netNamedPipeBindingConfig"
                         binding="netNamedPipeBinding"
                         contract="IMyService" >
            </endpoint>
        </service>
    </services>
    <serviceHostingEnvironment  multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Client Config (ASP.NET website, same machine, different VDIR from service)

    <system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_IMyService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
                maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport protectionLevel="EncryptAndSign" />
                </security>
            </binding>
        </netNamedPipeBinding>
    </bindings>
    <client>
        <endpoint
                address="net.pipe://localhost/netNamedPipeBinding"
                binding="netNamedPipeBinding"
                bindingConfiguration="NetNamedPipeBinding_IMyService"
                contract="MyService.IMyService"
                name="NetNamedPipeBinding_IMyService">
        </endpoint>
    </client>
</system.serviceModel>

(Service & contract names changed to protect the innocent)

The C# isn't anything special, just the Add-Service-Reference generated proxy. (And all that code works fine with the wsHttp binding

MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
  • post some code - web.config of both sites, etc. – Lukas Kubis Apr 16 '14 at 12:03
  • I added the relevant config. – MatthewMartin Apr 16 '14 at 14:19
  • Can you add some details about how you configured IIS? How are your bindings setup? Did you enable net.pipe as an enabled protocol on the service site? http://stackoverflow.com/questions/16820022/binding-net-pipe-to-default-web-site-via-iis – Kenneth Ito Apr 18 '14 at 16:57
  • I updated with some of the relevant IIS config (middle of Q). As far as I can tell net.pipes is enabled (as in I it displays the same sort of things show in that question). It isn't enabled in the sense of working of course. – MatthewMartin Apr 18 '14 at 17:08
  • Possibly something askew with the MetaDataExchange configuration? – Nathan Apr 19 '14 at 19:38
  • Mex works locally (i.e. running in a console), and after deploying to IIS, it seems that mex should be irrelevant since I'm not doing add service reference and would expect to be able to since named pipes can't cross machines (in wcf) – MatthewMartin Apr 22 '14 at 20:49

1 Answers1

1

You cannot set the base address of a named pipe when it is hosted in IIS in this fashion. As a result the service can not be found by the client. Look at the answer here for more details: controlling-the-name-of-a-named-pipe-when-hosting-wcf-net-pipe-binding-in-iis

Community
  • 1
  • 1
John Garrard
  • 167
  • 4
  • Thanks for sharing this link. This resolved the issue for me. We moved our main platform from Windows Server 2008 R2 to Windows Server 2016 and encountered this issue. The * binding worked fine in 2008 R2 with "localhost" but in 2016, I had to explicitly bind "localhost" – Charles Chen May 03 '18 at 16:09