c# - WCF 错误:套接字连接已中止
问题描述
我使用托管 WCF 连接topshelf
和服务配置使用行为和 tcp 连接,如下所示:
<behaviors>
<serviceBehaviors>
<behavior name="MetaDataBehvior">
<serviceMetadata />
</behavior>
<behavior>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Transport">
<!--Transport security is enabled Because all machinses on the same Domain (intranet) -->
<!-- http://www.karthikscorner.com/sharepoint/wcf-transport-security/ -->
<!--Transport security is enabled-->
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign" />
</security>
</binding>
</netTcpBinding>
</bindings>
我什至尝试使用节流,但在多次使用该服务后没有任何变化我收到错误:
发生一个或多个错误。
System.AggregateException:发生一个或多个错误。---> System.ServiceModel.CommunicationException:套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题造成的。本地套接字超时为“00:00:59.9844041”。---> System.IO.IOException: 写操作失败,见内部异常。---> System.ServiceModel.CommunicationException:套接字连接被中止。这可能是由于处理您的消息时出错或远程主机超出接收超时,或者是潜在的网络资源问题造成的。本地套接字超时为“00:00:59.9844041”。
任何关于如何追踪或解决此问题的建议
解决方案
WCF 包含一些可用于跟踪/调试应用程序的类
第一个是启用 Trace logging/message logging,您可以使用 SvcConfigEditor 让您的生活更简单
然后只需进入 EndToEnd Tracing 部分并编辑配置以满足您的需求,
将跟踪与消息一起使用将为您提供一种将 messageID(一个 guid)与生成的跟踪相关联的方法,并且在某些情况下找到给您带来问题的消息。
您可以检查的另一件事是在您的 ServiceBehavior 设置中启用ServiceAudit标记,这将允许您检查由您的服务产生的安全事件。
推荐阅读
- npm - Nexus 存储库缓存未与 npm 模块一起上传
- typescript - 如何将我的静态文件复制到 typescript express 项目中的输出位置?
- reactjs - 如何在 React Router 中正确发送查询
- jquery - Tolchain for ASP.NET Core、Typescript 和类型依赖项、npm,保存到 Git
- reactjs - 反应:在图像加载时显示加载微调器
- android - 如何为我的应用添加音乐设置?喜欢安卓游戏
- angular - Angular Material Theme 被部分加载
- c# - LINQ 中的动态搜索条件和选择 - C#
- sql-server - 参数输入上的列名无效
- android - Microphone.GetPosition 在特定场景中在 Android 上中断