2011-08-04 126 views
3

我有很多WCF服务,我需要从另一个服务调用一个服务。我决定为此使用netNamedPipeBinding没有端点监听net.pipe异常

我的web.config文件看起来像这样。 (我在这里没有复制无关的东西)

<services> 
      <service    name="Services.AuthorizationService" > 
      <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" > 
      <endpoint 
       name="AuthorizationService" 
       address="" 
       binding="basicHttpBinding"    contract="ServiceContracts.IAuthorizationService" /> 
      <endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc" 
        binding="netNamedPipeBinding"     contract="ServiceContracts.IAuthorizationService" 
        name="AuthorizationNamedPipeEndpoint"/>   
      </service> 
</Services> 

在web.config文件中的客户端部分看起来是这样的:

<client> 
     <endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc" 
     binding="netNamedPipeBinding"   contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" /> 
    </client> 

我想打电话给OperationContract S的一个(GetDetails)像这样:

using (ChannelFactory<IAuthorizationService> authorizationChannel = new ChannelFactory<IAuthorizationService>("AuthorizationServiceNamedPipe")) 
         { 
          IAuthorizationService authorizationService = authorizationChannel.CreateChannel(); 
          var response = authorizationService.GetDetails(new GetDetailsRequestMessage()); 
         } 

当我执行这个代码,我得到在该行的例外,我调用OperationContract的GetDetails:

在net.pipe://localhost/TestSite/AuthorizationService.svc上没有可以接受消息的端点进行监听。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。

我无法找出确切的问题。也没有InnerException。 我使用Windows7机器和IIS版本是IIS7.5。请注意,我可以从我的Winform应用程序中调用此服务,没有任何问题。 net.pipe绑定被添加到IIS中的网站绑定。

如何确保服务使用net.pipe传输正常工作?在HTTP的情况下,我们可以浏览IE并确保它。

+0

这两个服务是否在同一台机器上运行? – Franchesca

+0

@Franchesca:是的,它们在同一台机器上的IIS 7.5上运行。 – Learner

+0

我能找到的是您没有在服务器端提供地址或主机基地址。这是一个错误吗? – Jack

回答

9

Control Panel —> Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.5激活Windows Communication Foundation Non-HTTP Activation组件后,此问题解决。

当它被激活并且使用非HTTP绑定时,WAS会自动使用。

我做了一个非常基本的&愚蠢的错误,但它帮助我学习了很多东西。下面的文章对我帮助很大:

Extend Your WCF Services Beyond HTTP With WAS

Hosting WCF Services in Windows Activation Service

WCF gets Access denied when the consumer try invoke a WCF service calls hosted on Virtual Machine

最后一个环节给了我一个指针服务器证书相关的配置可能会引起麻烦。我正在为该服务添加一个行为(在问题中没有看到)。该行为正在使用服务器证书。

+0

我有一个WCF服务托管在IIS之外。从我在IIS内部运行的RIA域服务中,我必须通过nettcpnamedpipe绑定来调用托管在IIS之外的此WCF服务。它似乎没有工作。你有没有面对同样的问题? –

0

我们在SharePoint 2013中遇到了同样的问题。在安装过程中发生的某些事情和激活设置未打开。我不确定这是否是应用程序服务器功能或其他问题。

非常感谢这篇文章!我们也能够更正SP 2013问题。以下是我们遇到的例外情况:对于可能遇到此问题的用户还有:

System.ServiceModel.EndpointNotFoundException:在net.pipe:// localhost/SecurityTokenServiceApplication/appsts处没有监听端点。svc可以接受该消息。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。 --->

System.IO.PipeException:在本地计算机上找不到管道端点'net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc'。