Is it possible to have a WCF client running in an ASPX call an SVC via net.pipe in another site on the same machine?

StackOverflow https://stackoverflow.com/questions/23094840

Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top