我有WCF应用程序,我添加了一个客户端来使用该服务。还有另一个由另一个开发人员写的服务,它向我的服务发送消息。 我的服务在本地托管,并打开了访问端口。我的服务加入来自其他服务的请求并记录消息。
但我收到此错误:由于管道已关闭,无法完成操作。这可能是由管道另一端的应用程序引起的。 我的服务在本地安装并启动。
我尝试了远程网络,但它也引发了错误:连接到主机丢失......
服务类
namespace InboundMessage.Service;
Operator: IOperator {
}
namespace InboundMessage.Service;
IOperator {
}
的App.config
<configuration>
<system.web>
<compilation debug="true">
</compilation>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="meta">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="InboundMessage.Service.Operator" behaviorConfiguration="meta" >
<endpoint address="basic" binding="basicHttpBinding" contract="InboundMessage.Service.IOperator"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress = "http://X:Port/InboundMessage.Service/"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
客户
的App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="InboundMessage.Service" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://X:port/InboundMessage.Service/"
binding="basicHttpBinding" bindingConfiguration="InboundMessage.Service"
contract="IMetadataExchange" name="InboundMessage.Service" />
</client>
</system.serviceModel>
</configuration>