简体   繁体   English

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

[英]WCF Returning Error “There was no endpoint listening at net.pipe…”

For some reason I cannot get the Net.Pipe endpoint (EP) of my service working. 由于某种原因,我无法使服务的Net.Pipe端点(EP)正常工作。

This is a .Net 4.0 WCF Service hosted in IIS7. 这是IIS7中托管的.Net 4.0 WCF服务。

There are two faults... 有两个错误...

  • Firstly the EP will not provide meta data. 首先,EP将不提供元数据。
  • Second the EP will not actually work - I am testing it via the WCF Test Client which is part of VS2010. 其次,EP不能实际工作-我正在通过WCF测试客户端(它是VS2010的一部分)对其进行测试。

I think both are actually related to the same problem. 我认为两者实际上都与同一个问题有关。

The actual error received is... 收到的实际错误是...

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.

The first thing I have noticed is that no matter what I call my pipe in the base addresses it gets renamed to [machinename].[domainname] which seems strange. 我注意到的第一件事是,无论我在基址中称呼我的管道如何,它都会被重命名为[machinename]。[domainname],这似乎很奇怪。 This is evident in the service Meta data that is output. 这在输出的服务元数据中很明显。 However, if I use my pipe name or this renamed name in the test client neither will work. 但是,如果我在测试客户端中使用管道名称或此重命名的名称,则两者均将无效。

I have also, enabled WAS in Windows Features, set the site bindings for all protocols in IIS and also typed in the names of the protocols in the "Enabled Protocols" box in IIS (http, net.tcp, net.pipe). 我还已经在Windows功能中启用WAS,设置了IIS中所有协议的站点绑定,并且还在IIS的“已启用协议”框中键入了协议名称(http,net.tcp,net.pipe)。 I have also checked that the "Net.Pipe listener adaptor" is started in Windows Servics. 我还检查了Windows Servics中是否已启动“ Net.Pipe侦听器适配器”。

My http and net.tcp EP's both work fine and return Meta Data. 我的http和net.tcp EP都可以正常工作并返回元数据。

My config is listed below - has anyone got any idea what could be stopping this EP from working?? 我的配置在下面列出-有没有人知道什么可以阻止此EP正常工作? I'm pretty sure its something simple!! 我很确定这很简单!

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

The WCF test client was able to see my named pipe endpoint after I added the following mex endpoint: 在添加以下mex端点后,WCF测试客户端能够看到我的命名管道端点:

By looking at the configuration that the test client generated, I discovered that I had my client's endpoint address wrong. 通过查看测试客户端生成的配置,我发现客户端的端点地址错误。 This ended up working for me... 最终为我工作...

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

I hope this helps someone. 我希望这可以帮助别人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM