我使用命名管道在同一台计算机上的两个不同应用程序之间进行通信,两者都是.NET 3.5应用程序。
服务器是自托管的。
在某些计算机上,用户报告说它无法正常工作。 在调试我的客户端尝试连接管道时,这就是我发现的:
There was no endpoint listening at net.pipe://localhost/MyAppServices that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
我排除了我的客户端是我使用WCF Test Client时的罪魁祸首,在尝试访问net.pipe://localhost/MyAppServices
或net.pipe://localhost/MyAppServices/mex
时出现了完全相同的错误。
知道为什么会这样吗?如何确保成功创建和打开端点?我的服务器不会抛出任何异常。
这是我的服务器的web.config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<netNamedPipeBinding>
<binding name="NPBinding_IWCFClientServiceAPI" transactionProtocol="OleTransactions" receiveTimeout="infinite" />
</netNamedPipeBinding>
</bindings>
<services>
<service
name="MyApp.Client.Core.Managers.WCFClientService"
behaviorConfiguration="WCFClientServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/MyAppServices/" />
</baseAddresses>
</host>
<endpoint address="" binding="netNamedPipeBinding" contract="MyApp.BL.Interfaces.Service.IWCFClientServiceAPI" bindingConfiguration="NPBinding_IWCFClientServiceAPI">
</endpoint>
<endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFClientServiceBehavior">
<serviceMetadata httpGetEnabled="False"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>