【发布时间】:2010-12-28 09:13:03
【问题描述】:
在我的 WCF 服务中,尝试传输大数据时,我经常收到错误消息:底层连接已关闭:连接已意外关闭
我想知道是什么特殊原因引发了这个错误,所以我设置了 WCF Tracing 并且可以读取 traces.svclog 文件。
问题是,我可以在这个文件中看到很多关于流程的信息,我可以看到出现异常的确切时间,但我看不到确切的原因。是由于 MaxReceivedMessageSize 还是类似的原因。
是不是 traces.svclog 不能包含此类信息,还是我做错了什么?
如何获得这些信息?
已编辑(添加):
来自我的服务器端 app.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="NAVBinding_ICustomer_Service"
closeTimeout="01:50:00"
openTimeout="01:50:00" receiveTimeout="01:50:00" sendTimeout="01:50:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name = "Customer_Service" behaviorConfiguration="returnFaults">
<endpoint name="NAVBinding_ICustomer_Service"
address = "http://localhost:8000/nav/customer"
binding = "basicHttpBinding"
bindingConfiguration= "NAVBinding_ICustomer_Service"
contract = "NAVServiceReference.ICustomer_Service"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="returnFaults" >
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
已编辑(添加):
将 WCF 服务从“黑匣子”转变为易于排除故障的服务的正确和最佳方法是什么? 您使用哪些工具和技术对 WCF 服务进行故障排除?
【问题讨论】:
-
它应该在您的跟踪日志中,您要发送什么大小的文件?
-
文件大小约为 8 MB。实际上就是通过 XML 流传输的数据库表数据的大小,所以我不知道数据流的最终确切大小,可能包括 XML 标记信息。但它肯定比 MaxReceivedMessageSize 参数的默认 65536 大。
-
你能告诉我们服务器 app.config(
部分)吗?您使用 WCF 流式传输(例如,返回类型为 Stream的方法)还是缓冲传输(默认)?? -
我已将服务器 app.config 添加到我的问题内容中。考虑 WCF 流式传输 - 我的服务合同方法都没有返回类型为“Stream”(它们大多具有“someArray[]”返回类型)。
-
我的秘密正在客户端上跟踪...
标签: wcf web-services connection trace