我使用topshelf
托管WCF连接,服务配置使用行为和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: One or more errors occurred. ---> System.ServiceModel.CommunicationException: 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:00:59.9844041'. ---> System.IO.IOException: The write operation failed, see inner exception. ---> System.ServiceModel.CommunicationException: 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:00:59.9844041'.
有关如何跟踪或解决此问题的任何建议
最佳答案
WCF包含一些类,可用于跟踪/调试应用程序
首先是启用跟踪日志记录/消息日志记录,您可以使用SvcConfigEditor使您的生活更简单
然后只需进入“EndToEnd跟踪”部分并编辑配置以适合您的需求,
将跟踪与消息传递结合使用,将为您提供一种将messageID(GUID)与生成的跟踪相关联的方法,并且在某些情况下,可以找到给您带来问题的消息。
您可以检查的另一件事是在ServiceBehavior设置中启用ServiceAudit标记,这将使您可以检查由服务引起的安全事件。
关于c# - WCF错误: The socket connection was aborted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53603405/