WCF 服务无法打开套接字?
嗨,
我有一个 WCF 服务托管在 IIS 中,带有 WAS(net.tcp) 和一个连接到该服务的 winform 客户端。除了一台计算机之外,这在所有计算机上都可以正常工作。我可以看到该服务在尝试连接时正在启动,但随后客户端只是等待,服务上永远不会触发登录方法?
为了确保服务是否收到任何消息,我实现了 CustomMessageInspector(IDispatchMessageInspector、IParameterInspector),并在所有 4 个方法(AfterReceiveRequest、BeforeSendReply、AfterCall、BeforeCall)处设置了断点。这些方法都没有被触发吗?当在另一台计算机上运行完全相同的设置时,我们可以看到它被正确触发。
请注意,WCF 服务在每台单独的计算机上运行。如果发生故障的计算机允许其 winform 客户端连接到另一台计算机的 WCF 服务(有效),那么一切都会按预期工作。
打开跟踪和消息日志时,我可以看到以下错误:
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.SocketConnectionAbort.aspx</TraceIdentifier>
<Description>SocketConnection aborted</Description>
<AppDomain>/LM/W3SVC/1/ROOT/test-1-129666827401375509</AppDomain>
<Source>System.ServiceModel.Channels.SocketConnection/10479095</Source>
</TraceRecord>
</DataItem>
</TraceData>
不是明显的异常。
我已经检查过服务正在运行(NetTcpActivator、NetTcpPortSharing、WAS)。
如何找到有关此异常的更多信息
Edit1: 服务的地址如下所示:net.tcp://localhost/MyDev/MyClientService.svc/Regular 如果我在 WCF 测试中尝试此 URL客户端它会抛出异常。如果我尝试 http://localhost/MyDev/MyClientService.svc 它可以生成所有服务方法,但是每个方法旁边都会有一个红色感叹号?
正如我所说,服务和客户端在所有其他计算机上工作正常,这台出现故障的计算机的唯一区别是它是通过 VPN 进行的,但这应该不会有任何问题。发生故障的计算机能够通过 VPN 针对我的主要服务运行其 winform 客户端。
该服务确实已连接到 MS SQL 数据库,但看起来它能够在故障服务启动时连接到该数据库。如果 WCF 服务无法连接到 SQL 数据库,我们将遇到另一个异常。
Hi,
I have a WCF service hosted in IIS with WAS(net.tcp) and a winform client that connects to this service. This works fine on all but one computer. I can see that the service is starting up when trying to connecting to it but then the client just waits, the login methods is never triggered on the service?
To make sure if the service is getting any messages I have implemented a CustomMessageInspector (IDispatchMessageInspector, IParameterInspector) and set a breakpoint at all 4 methods (AfterReceiveRequest, BeforeSendReply, AfterCall, BeforeCall). None of these methods is triggered? When running the exact same setup on another computer we can see that it is triggered correcly.
Pleas note that the WCF service is runned at each individual computer. If the failing computer lets its winform client connect to another computers WCF service(that works) then everything is working just as expected.
When turning on the trace and message log I can see the following error :
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.SocketConnectionAbort.aspx</TraceIdentifier>
<Description>SocketConnection aborted</Description>
<AppDomain>/LM/W3SVC/1/ROOT/test-1-129666827401375509</AppDomain>
<Source>System.ServiceModel.Channels.SocketConnection/10479095</Source>
</TraceRecord>
</DataItem>
</TraceData>
Not a clear exception.
I have checked so the serivces is running(NetTcpActivator, NetTcpPortSharing, WAS).
How to find out more about this exception
Edit1: The adress to the service looks like this : net.tcp://localhost/MyDev/MyClientService.svc/Regular and if i try this URL in WCF Test Client it will throw an exception. If I instead try http://localhost/MyDev/MyClientService.svc it can generate all the service methods but there will be a red exclamation mark next to each of the methods?
As I said, the service and client works fine on all other computers, the only diffrence for this failing computer is that it is over VPN but that should not be any problem. The failing computer is able to run its winform client against my main service over VPN.
The service do got a connection to a MS SQL database but it looks like it able to connect to it on startup on the failing service. If the WCF service was not able to connect to the SQL database we would have another exception.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论