我有一个可通过http和net.pipe访问的服务.它托管在IIS 7(Server 2008)中.我可能正在为同一台机器上的几个客户托管此服务的不同实例,因此HTTP设置为虚拟主机名等.这一切都正常.
我以为我会做类似的网名命名管道绑定 - 在命名管道基地址中使用某种形式的客户'virtualhostname',因此允许我使用不同的net.pipe urns访问不同的客户实例(我意识到网络.管道名称是URN不是URL,因此它们可以基本上是任意的但我认为我会遵循与HTTP地址类似的模式).
这是我的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>
Run Code Online (Sandbox Code Playgroud)
但是,在访问服务的WSDL时 - IIS似乎忽略了net.pipe的基址.相反,我得到了机器的真实主机名,以及似乎完全由IIS格式化的net.pipe地址URN.
<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>
Run Code Online (Sandbox Code Playgroud)
由于无法控制net.pipe名称的形成方式,我将无法区分机器上的多个客户服务实例.有没有人知道如何在IIS环境中控制网络命名管道绑定URN?
(我在测试期间做了很多独立的net.pipe托管(即新的ServiceHost())所以我知道我的net.pipe绑定在IIS之外工作,并且允许控制使用的确切命名管道URN)
如果无法在IIS中控制名称 - 是否有人在同一台计算机上托管和访问多个单独的net.pipe服务实例?