.NET 4.0を使用して、IIS7.0でホストされるWCFWebサービスを作成しています。以下のような奇妙なWCF例外を除いて、すべてが正常に見えます。
Message : The underlying connection was closed: The connection was closed unexpectedly.
Stack Trace : Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
一見したところ、メッセージサイズに関連するものであると思ったので、バインディング構成を調整しました。
<binding
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01: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="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
残念ながら、期待どおりに機能しません。別のアイデアが浮かびました。IISの構成に関連するものだと思ったので、web.configを次のように変更しました。
<system.web>
<compilation targetFramework="4.0" />
<globalization culture="en-US" uiCulture="en-US" />
<customErrors mode="RemoteOnly"></customErrors>
<httpRuntime executionTimeout="10800" maxRequestLength="2147483647" />
</system.web>
残念ながら、上記の変更はどれも私の問題の解決に役立ちません。クライアントサイトで、その奇妙なWCF例外がまだ表示されています。以下はクライアントバインディングです。
<binding name="myClientBinding"
closeTimeout="00:10:00"
openTimeout="00:10:00"
receiveTimeout="01:00:00"
sendTimeout="01:00:00"
allowCookies="false"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647"
maxBufferPoolSize="524288"
maxReceivedMessageSize="2147483647"
messageEncoding="Text"
textEncoding="utf-8"
transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas
maxDepth="21474836"
maxStringContentLength="21474836"
maxArrayLength="21474836"
maxBytesPerRead="21474836"
maxNameTableCharCount="21474836" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
WCFとIISで何が起こっているかについてのアイデア...!