WCF返回错误“net.pipe没有端点监听....”

时间:2012-05-28 11:03:15

标签: .net wcf iis named-pipes was

出于某种原因,我无法使我的服务的Net.Pipe端点(EP)正常工作。

这是IIS7中托管的.Net 4.0 WCF服务。

有两个错误......

  • 首先,EP不会提供元数据。
  • 其次EP实际上不起作用 - 我是通过作为VS2010一部分的WCF测试客户端测试的。

我认为两者实际上都与同一问题有关。

收到的实际错误是......

There was no endpoint listening at net.pipe://[machinename].[domainname]/Services/TestService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

我注意到的第一件事是,无论我在基地址中调用管道,它都会被重命名为[machinename]。[domainname]这看起来很奇怪。这在输出的服务元数据中很明显。但是,如果我在测试客户端中使用我的管道名称或此重命名的名称也不起作用。

我也已经启用在Windows功能,设置网站绑定在IIS中的所有协议,并键入该协议在IIS中的“启用的协议”框中的名称(HTTP,的net.tcp,net.pipe )。我还检查过在Windows Servics中启动了“Net.Pipe监听器适配器”。

我的http和net.tcp EP都运行良好并返回Meta Data。

我的配置列在下面 - 有谁知道什么可以阻止这个EP工作?我很确定这很简单!

 <system.serviceModel>
    <behaviors>
      <!-- EP Behaviors -->
      <endpointBehaviors>
        <behavior name="PayloadMessageInspector">
          <MessageHeaderBehavior />
          <MessagePayloadBehavior />
        </behavior>
      </endpointBehaviors>
      <!-- Service Behaviors -->
      <serviceBehaviors>
        <behavior name="GenericServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceMetadata httpGetEnabled="true" policyVersion="Policy15"  />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <!-- Bindings Section -->
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <bindings>
      <!-- Basic Http Binding -->
      <basicHttpBinding>
        <binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
      <!-- Net TCP Binding -->
      <netTcpBinding>
        <binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760" />         
      </netTcpBinding>
      <!-- Net Pipe Binding -->
      <netNamedPipeBinding>
        <binding maxReceivedMessageSize="10485760" maxBufferSize="10485760" maxBufferPoolSize="10485760" />
      </netNamedPipeBinding>      
    </bindings>
    <!-- Services Section -->
    <services>      
      <!-- Membership Service -->
      <service name="TestService" behaviorConfiguration="GenericServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost/Services/TestService.svc" />
            <add baseAddress="net.tcp://localhost/Services/TestService.svc"/>
            <add baseAddress="net.pipe://Dev/Services/TestService.svc"/>
          </baseAddresses>
        </host>
        <!-- HTTP -->
        <endpoint 
          address="" 
          binding="basicHttpBinding" 
          contract="ITestService" name="TestServiceBasicHttp" behaviorConfiguration="PayloadMessageInspector" />
        <!-- NetTCP -->
        <endpoint
          address=""
          binding="netTcpBinding"
          contract="ITestService" name="TestServiceNetTcp" behaviorConfiguration="PayloadMessageInspector" />
        <!-- NetPipe -->
        <endpoint
          address=""
          binding="netNamedPipeBinding"
          contract="ITestService" name="TestServiceNetPipe" behaviorConfiguration="PayloadMessageInspector" />
        <!-- Mex (Net.Tcp / Net.Pipe ) -->
        <endpoint name="TestServiceNetTcpMex" address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
        <endpoint name="TestServiceNetPipeMex" address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <!-- Extensions -->
    <extensions>
      <behaviorExtensions>
        <add name="MessageHeaderBehavior" type="ServiceMessageHeaderBehavior, TestService.Logging" />
        <add name="MessagePayloadBehavior" type="ServiceMessagePayloadBehavior, TestService.Logging" />
      </behaviorExtensions>
    </extensions>   
  </system.serviceModel> 

1 个答案:

答案 0 :(得分:1)

在添加以下mex端点后,WCF测试客户端能够看到我的命名管道端点:

通过查看测试客户端生成的配置,我发现我的客户端端点地址错误。这最终为我工作......

net.pipe://localhost/{webapproot}/{path}/ServiceName.svc/{relativeaddress}

我希望这有助于某人。