C# 无法完成操作,因为管道已关闭。这可能是由于管道另一端的应用程序退出导致的

C# 无法完成操作,因为管道已关闭。这可能是由于管道另一端的应用程序退出导致的,c#,.net,web-services,wcf,hosting,C#,.net,Web Services,Wcf,Hosting,我有一个WCF应用程序,我添加了一个客户端来使用该服务。另一个开发人员编写的另一个服务向我的服务发送消息。 我的服务在本地托管,并打开了访问端口。我的服务接受来自其他服务的请求并记录消息 但我得到了这个错误:操作无法完成,因为管道已关闭。这可能是由于管道另一端的应用程序退出造成的。 我的服务已在本地安装并已启动 我尝试了telenet,但它也抛出了错误:与主机的连接丢失 服务等级 namespace InboundMessage.Service; Operator: IOpera

我有一个WCF应用程序,我添加了一个客户端来使用该服务。另一个开发人员编写的另一个服务向我的服务发送消息。 我的服务在本地托管,并打开了访问端口。我的服务接受来自其他服务的请求并记录消息

但我得到了这个错误:操作无法完成,因为管道已关闭。这可能是由于管道另一端的应用程序退出造成的。 我的服务已在本地安装并已启动

我尝试了telenet,但它也抛出了错误:与主机的连接丢失

服务等级

    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>
    <?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>

客户

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>
    <?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>


k,很明显-但是,你确定服务器正在运行吗?@Dreamer不确定我是否理解你的要求?服务还是服务器?服务在我的本地机器中