没有端点监听 net.pipe 异常
我有许多 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>
web.config 文件中的客户端部分如下所示:
<client>
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" />
</client>
我试图像这样调用 OperationContract
之一:
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中浏览并确保它。
I have many WCF services and I need to call one service from another. I decided to use netNamedPipeBinding
for this purpose.
My web.config file looks like this. (I have not copied irrelevant stuff here.)
<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>
The client section in the web.config file looks like this:
<client>
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" />
</client>
I am trying to call one of the OperationContract
s (GetDetails) like this:
using (ChannelFactory<IAuthorizationService> authorizationChannel = new ChannelFactory<IAuthorizationService>("AuthorizationServiceNamedPipe"))
{
IAuthorizationService authorizationService = authorizationChannel.CreateChannel();
var response = authorizationService.GetDetails(new GetDetailsRequestMessage());
}
When I execute this code, I get the exception at the line I invoke the OperationContract GetDetails:
There was no endpoint listening at net.pipe://localhost/TestSite/AuthorizationService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I am not able to find out the exact problem. There is no InnerException as well.
I am using Windows7 machine and IIS version is IIS7.5. Please note that I can call this service from my Winform application without any problem. net.pipe binding is added to the website bindings in the IIS.
How to ensure that the service is working properly using the net.pipe transport? In case of HTTP, we can browse in IE and ensure it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从
控制面板 -> 激活
。Windows Communication Foundation Non-HTTP Activation
组件后,此问题得到解决程序和功能,然后单击左侧窗格中的“打开或关闭 Windows 组件”。展开 Microsoft .NET Framework 3.5当它被激活并且您使用非 HTTP 绑定时,将自动使用 WAS。
我做了一个非常基本的&愚蠢的错误,但它帮助我学到了很多东西。以下文章对我帮助很大:
扩展您的 WCF 服务使用 WAS 超越 HTTP
在 Windows 激活服务中托管 WCF 服务
当消费者尝试调用虚拟机上托管的 WCF 服务调用时,WCF 访问被拒绝
最后一个链接给了我一个提示,即服务器证书相关配置可能是造成麻烦。我正在为服务添加一个行为(问题中没有看到)。该行为是使用服务器证书。
This problem was solved after activating
Windows Communication Foundation Non-HTTP Activation
component from theControl Panel —> Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.5
.When it's activated and you use non-HTTP binding, the WAS is automatically used.
I did a very basic & silly mistake but it helped me to learn many things. The following articles helped me a lot:
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
The last link gave me a pointer that Server Certificate related configuration might be causing troubles. And I was adding a behavior (which is not seen in the question) for the service. That behaviour was using the Server Certificates.
我们在 SharePoint 2013 中遇到了同样的问题。安装过程中发生了一些问题,并且激活设置未打开。我不确定这是应用程序服务器功能的问题还是其他问题。
所以谢谢你的帖子!我们也能够纠正 SP 2013 问题。以下是我们为那些可能遇到此问题的人看到的异常:
System.ServiceModel.EndpointNotFoundException:没有端点在 net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc 上侦听可以接受消息。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。 --->
System.IO.PipeException:在本地计算机上找不到管道端点“net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc”。
We were getting the same issue in SharePoint 2013. Something happened during the install and the activation settings weren't turned on. I'm not sure if it was an issue with the application server feature or something else.
So thanks for the post! We were able to correct the SP 2013 problem too. Here's the exception we were seeing for those who might run into it also:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. --->
System.IO.PipeException: The pipe endpoint 'net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc' could not be found on your local machine.