没有端点监听net.pipe异常

Lea*_*ner 3 wcf netnamedpipebinding wcf-binding

我有很多WCF服务,我需要从另一个服务中调用一个服务.我决定netNamedPipeBinding为此目的使用.

我的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>
Run Code Online (Sandbox Code Playgroud)

web.config文件中的客户端部分如下所示:

<client>
      <endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
       binding="netNamedPipeBinding"            contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" />
    </client>
Run Code Online (Sandbox Code Playgroud)

我试图OperationContract像这样调用其中一个(GetDetails):

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

当我执行此代码时,我在调用OperationContract GetDetails的行中得到异常:

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

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

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

Lea*_*ner 9

激活Windows Communication Foundation Non-HTTP Activation组件后,此问题得以解决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.

当它被激活并且您使用非HTTP绑定时,将自动使用WAS.

我做了一个非常基本和愚蠢的错误,但它帮助我学到了很多东西.以下文章对我帮助很大:

使用WAS扩展超出HTTP的WCF服务

在Windows激活服务中托管WCF服务

当消费者尝试调用虚拟机上托管的WCF服务调用时,WCF会拒绝访问

最后一个链接给了我一个指针,服务器证书相关的配置可能会导致麻烦.我正在为服务添加一个行为(在问题中没有看到).该行为使用的是服务器证书.