I have a service accessible via http and net.pipe. It is being hosted in IIS 7 (Server 2008). I may be hosting different instances of this service for several customers on the same machine and hence the HTTP is setup with virtual hostnames etc. This is all working fine.
I thought I would do similar for the net named pipe binding - using some form of
the customers 'virtualhostname' in the named pipe base address, therefore allowing me
to access the different customer instances with different net.pipe urns (I realize
the net.pipe names are URN's not URL's so they can be essentially arbitrary but
I thought I would follow a similar pattern to the HTTP addresses).
Here is my web.config
<service name="Administration" behaviorConfiguration="AdministrationBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="normalWsBinding" contract="IAdministration" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="" binding="netNamedPipeBinding" bindingConfiguration="normalNetNamedPipeBinding" contract="IAdministration" />
<endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://virtualhostname.com/service" />
<add baseAddress="net.pipe://virtualhostname.com/administration/service" />
</baseAddresses>
</host>
</service>
However,
when accessing the WSDL for the service - the base address for the net.pipe seems
to be ignored by IIS. Instead I get the real hostname of the machine, and a
net.pipe address URN that seems to have been formatted entirely by IIS.
<wsdl:port name="NetNamedPipeBinding_IAdministration" binding="tns:NetNamedPipeBinding_IAdministration">
<soap12:address location="net.pipe://realhostname/service/Administration.svc"/>
<wsa10:EndpointReference>
<wsa10:Address>net.pipe://realhostname.com/service/Administration.svc</wsa10:Address>
<Identity>
<Spn>host/realhostname.com</Spn>
</Identity>
</wsa10:EndpointReference>
</wsdl:port>
With no control over the way net.pipe names are formed, I will not be able to discriminate
between the multiple customer service instances on the machine. Does anyone have any clue as to how
the net named pipe binding URN can be controlled within the IIS environment?
(I do a lot of standalone net.pipe hosting during testing (i.e. new ServiceHost())
so I know that my net.pipe bindings do work outside of IIS, and do allow control
over the exact named pipe URN used)
If the names can't be controlled within IIS - does anyone have any experience with
hosting and accessing multiple separate net.pipe service instances on the same
machine?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…