IIS主机上的WCF超时异常
谢谢你。 我在5分钟后收到超时异常,尽管所有超时设置为10分钟。Wcf托管在IIS中。 客户端配置如下所示 "IIS主机上的WCF超时异常,wcf,iis,timeoutexception,communicationexception,Wcf,Iis,Timeoutexception,Communicationexception,谢谢你。 我在5分钟后收到超时异常,尽管所有超时设置为10分钟。Wcf托管在IIS中。 客户端配置如下所示 " " 服务器配置如下所示 <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true"> <serviceActivations> <add service="ReportingService" relativ
"
服务器配置如下所示
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add service="ReportingService" relativeAddress ="ReportingService.svc" factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="customBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
<serviceTimeouts transactionTimeout="00:10:00" />
<exceptionMarshalling/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="customEndpointBehavior">
<protobuf maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<services>
<service name="Sample.ReportingService" behaviorConfiguration="customBehavior">
<endpoint binding="customBinding" bindingConfiguration="CustomNetTcpBinding" behaviorConfiguration="customEndpointBehavior" contract="Sample.IReportingService" />
</service>
</services>
<bindings>
<customBinding>
<binding name="CustomNetTcpBinding" closeTimeout="00:00:05" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<transactionFlow/>
<gZipMessageEncoding enableCompression="true" innerMessageEncoding="textMessageEncoding">
<readerQuotas maxDepth="999999999" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="999999999" maxNameTableCharCount="999999999" />
</gZipMessageEncoding>
<windowsStreamSecurity/>
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>'
'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:09:59.9970000'. ---> System.IO.IOException: The read 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:09:59.9970000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
--- End of inner exception stack trace ---
at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
--- End of inner exception stack trace ---
at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.<>c__DisplayClass1.<PerformInvocation>b__0(WcfInvocation wcfInvocation)
at Castle.Facilities.WcfIntegration.WcfInvocation.Proceed()
at Castle.Facilities.WcfIntegration.RepairChannelPolicy.Apply(WcfInvocation wcfInvocation)
at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.PerformInvocation(IInvocation invocation, IWcfChannelHolder channelHolder, Action`1 action)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.IWcfChannelHolderProxy_3.ReportRequest(ReportDefinitionContract rpt)
at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
at System.Threading.Tasks.Task.Execute()'
'
这是间歇性问题。在服务中,我从数据库服务器获取数据。例外情况如下
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add service="ReportingService" relativeAddress ="ReportingService.svc" factory="Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration"/>
</serviceActivations>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="customBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
<serviceTimeouts transactionTimeout="00:10:00" />
<exceptionMarshalling/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="customEndpointBehavior">
<protobuf maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<services>
<service name="Sample.ReportingService" behaviorConfiguration="customBehavior">
<endpoint binding="customBinding" bindingConfiguration="CustomNetTcpBinding" behaviorConfiguration="customEndpointBehavior" contract="Sample.IReportingService" />
</service>
</services>
<bindings>
<customBinding>
<binding name="CustomNetTcpBinding" closeTimeout="00:00:05" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<transactionFlow/>
<gZipMessageEncoding enableCompression="true" innerMessageEncoding="textMessageEncoding">
<readerQuotas maxDepth="999999999" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="999999999" maxNameTableCharCount="999999999" />
</gZipMessageEncoding>
<windowsStreamSecurity/>
<tcpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
</system.serviceModel>'
'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:09:59.9970000'. ---> System.IO.IOException: The read 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:09:59.9970000'. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)
at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
at System.ServiceModel.Channels.ConnectionStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.NegotiateStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
--- End of inner exception stack trace ---
at System.Net.Security.NegotiateStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.NegotiateStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at System.ServiceModel.Channels.StreamConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)
--- End of inner exception stack trace ---
at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.<>c__DisplayClass1.<PerformInvocation>b__0(WcfInvocation wcfInvocation)
at Castle.Facilities.WcfIntegration.WcfInvocation.Proceed()
at Castle.Facilities.WcfIntegration.RepairChannelPolicy.Apply(WcfInvocation wcfInvocation)
at Castle.Facilities.WcfIntegration.Proxy.WcfRemotingInterceptor.PerformInvocation(IInvocation invocation, IWcfChannelHolder channelHolder, Action`1 action)
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.IWcfChannelHolderProxy_3.ReportRequest(ReportDefinitionContract rpt)
at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
at System.Threading.Tasks.Task.Execute()'
“System.ServiceModel.CommunicationException:套接字连接已中止。这可能是由于处理消息时出错、远程主机超过接收超时或基础网络资源问题造成的。本地套接字超时为“00:09:59.9970000”。-->System.IO.IOException:读取操作失败,请参阅内部异常。-->System.ServiceModel.CommunicationException:套接字连接已中止。这可能是由于处理消息时出错、远程主机超过接收超时或基础网络资源问题造成的。本地套接字超时为“00:09:59.9970000”。-->System.Net.Sockets.SocketException:远程主机强制关闭了现有连接
位于System.ServiceModel.Channels.SocketConnection.ReadCore(字节[]缓冲区、Int32偏移量、Int32大小、TimeSpan超时、布尔关闭)
---内部异常堆栈跟踪的结束---
位于System.ServiceModel.Channels.SocketConnection.ReadCore(字节[]缓冲区、Int32偏移量、Int32大小、TimeSpan超时、布尔关闭)
位于System.ServiceModel.Channels.SocketConnection.Read(字节[]缓冲区,Int32偏移量,Int32大小,TimeSpan超时)
位于System.ServiceModel.Channels.ConnectionStream.Read(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.Net.FixedSizeReader.ReadPacket(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.Net.Security.NegotiateStream.StartFrameHeader(字节[]缓冲区、Int32偏移量、Int32计数、AsyncProtocolRequest asyncRequest)
位于System.Net.Security.NegotiateStream.StartReading(字节[]缓冲区、Int32偏移量、Int32计数、AsyncProtocolRequest asyncRequest)
位于System.Net.Security.NegotiateStream.ProcessRead(字节[]缓冲区、Int32偏移量、Int32计数、AsyncProtocolRequest asyncRequest)
---内部异常堆栈跟踪的结束---
位于System.Net.Security.NegotiateStream.ProcessRead(字节[]缓冲区、Int32偏移量、Int32计数、AsyncProtocolRequest asyncRequest)
位于System.Net.Security.NegotiateStream.Read(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.ServiceModel.Channels.StreamConnection.Read(字节[]缓冲区、Int32偏移量、Int32大小、TimeSpan超时)
---内部异常堆栈跟踪的结束---
在Castle.Facilities.wcfinintegration.Proxy.WcfRemotingInterceptor.c_udisplayClass1.b_u0(wcfinocation-wcfinocation)
在Castle.Facilities.wcfinintegration.wcfinocation.procedure()中
在Castle.Facilities.wcfinintegration.RepairChannelPolicy.Apply(wcfinocation-wcfinocation)
在Castle.Facilities.wcfinintegration.Proxy.WcfRemotingInterceptor.PerformInvocation(IInvocation调用,IWCFCChannelHolder channelHolder,Action`1 Action)
在Castle.DynamicProxy.AbstractInvocation.procedure()中
在Castle.Proxies.IWcfChannelHolderProxy_3.报告请求(报告定义合同rpt)
位于System.Threading.Tasks.Task`1.InvokeFuture(对象futureAsObj)
在System.Threading.Tasks.Task.Execute()中
您是否发现:本地套接字超时为'00:09:59.9970000'尝试在两端增加receivetimeout
如果没有,我将尝试将所有超时设置为10分钟。让我们看看。。。实际上,这是间歇性的,因此无法找到根本原因。