简体   繁体   English

的CommunicationException; Store App-> .NET 4.5 WCF双工TCP服务; 即时超时

[英]CommunicationException; Store App -> .NET 4.5 WCF Duplex TCP Service; Instant Timeout

I am having trouble getting a Windows Store App to make calls into a WCF service. 我无法让Windows Store应用程序向WCF服务发出呼叫。

The service is a Duplex service using a netTCP binding. 该服务是使用netTCP绑定的双工服务。 The first time the client (A Windows 8.1 Store Application) uses the service, it throws an exception: 客户端(Windows 8.1 Store应用程序)首次使用该服务时,会引发异常:

An exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll but was not handled in user code mscorlib.dll中发生类型'System.ServiceModel.CommunicationException'的异常,但未在用户代码中处理

Additional information: The socket connection was aborted. 附加信息:套接字连接已中止。 This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. 这可能是由于处理您的消息时出错,远程主机超出了接收超时或潜在的网络资源问题引起的。 Local socket timeout was '00:09:59.9968452'. 本地套接字超时为“ 00:09:59.9968452”。

This timeout is near-equal to my max, 10 minutes. 这个超时时间几乎等于我最多10分钟的时间。 The exception, however, happens immediately, and breakpoints in the service function are never hit. 但是,异常会立即发生,并且永远不会碰到服务功能中的断点。 The two do seem to be talking at some level because altering the security protocol or the endpoint address cause other exceptions (security and connection as you would expect). 两者似乎确实是在某种程度上交谈,因为更改安全协议或端点地址会导致其他异常(如您期望的那样,是安全性和连接性)。 I put a breakpoint in the service and the function I am trying to call never gets hit. 我在服务中设置了一个断点,而我尝试调用的函数从未被击中。

I have tried: 我努力了:

  • Ensure feature equivalence between Service and Client NetTcpBinding configurations 确保服务和客户端NetTcpBinding配置之间的功能等效
  • Raise timeouts, sizes (1-10 minutes for each, 10000000 for max sizes) 提高超时时间,大小(每个大小1-10分钟,最大大小10000000)
  • Ensure all passed object types are DataContracts with default constructors 确保所有传递的对象类型均为具有默认构造函数的DataContracts
  • Prayer; 祷告; Considering a burnt offering 考虑offering祭

Any help would be greatly appreciated. 任何帮助将不胜感激。 New to WCF and having trouble finding help for the Windows Store / netTCP / Duplex targeted scenario. WCF的新增功能,无法为Windows Store / netTCP / Duplex目标方案找到帮助。

If your Windows Store App client and WCF service are on the same computer and you're not running the Windows Store App client from inside Visual Studio, then you need to enable loopback communication. 如果您的Windows Store App客户端和WCF服务位于同一台计算机上,并且您不是从Visual Studio内部运行Windows Store App客户端,则需要启用回送通信。 Check out this article: 查看这篇文章:

http://msdn.microsoft.com/en-us/library/windows/apps/dn640582.aspx http://msdn.microsoft.com/en-us/library/windows/apps/dn640582.aspx

At the very bottom it talks about the command line utility: checknetisolation 在最底部,它讨论了命令行实用程序:checknetisolation

Also, try making your method call as simple as possible with no return and no arguments. 另外,请尝试使您的方法调用尽可能简单,没有返回且没有参数。 I know you said you checked all of the 'DataContract' attributes. 我知道您说您检查了所有“ DataContract”属性。 But things can get tricky such as if you're using polymorphism and the base class doesn't have a 'KnownType' for a derived. 但是事情可能会变得棘手,例如,如果您使用多态性并且基类没有派生类的“ KnownType”。

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

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