我有一個C#WCF服務,它將實例化的.Net對象的集合傳遞給調用者。做工精細,但如果我嘗試過失敗與下面的異常集合中太多的對象:WCF服務調用失敗...我的配置文件有什麼錯誤?
{"An error occurred while receiving the HTTP response to http://myserver/MyAppService/MyAppService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details."}
{"The underlying connection was closed: An unexpected error occurred on a receive."}
{"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."}
{"An existing connection was forcibly closed by the remote host"}
這是完全reproduceable和數量的集合中的對象和對象的不是內容,是絕對相關。
基於我提出的另一篇文章,我嘗試對我的客戶端app.config文件和服務服務器端web.config文件進行更改。但是,這些更改並未解決問題,這使我認爲有可能我沒有正確設置我的配置文件。
下面是我的客戶端的app.config文件(不相關的東西刪除):
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_iMyAppService" closeTimeout="00:01:00"
openTimeout="00:01: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="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="Behaviors.EndpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://myserver/MyAppService/MyAppService.svc"
behaviorConfiguration="Behaviors.EndpointBehavior"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_iMyAppService"
contract="MyAppService.iMyAppService" name="BasicHttpBinding_iMyAppService" />
</client>
</system.serviceModel>
這裏是我的服務器端的web.config文件(不相關的東西刪除):
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Behaviors.EndpointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_iMyAppService"
closeTimeout="00:01:00"
openTimeout="01:00: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="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<services>
<service name="MyApp_WCFService.MyAppService">
<host>
<baseAddresses>
<add baseAddress="http://localhost/MyAppService/"/>
</baseAddresses>
</host>
<endpoint address="" behaviorConfiguration="Behaviors.EndpointBehavior" binding="basicHttpBinding" contract="MyApp_WCFService.iMyAppService" bindingConfiguration="BasicHttpBinding_iMyAppService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
這些看起來是否正確?如果是這樣,是否有任何我會錯過任何一個會使這項工作?
感謝
您是使用WCF服務配置編輯器還是手動修改這些文件? – 2012-02-22 16:16:11
我在自動創建後手動修改了這些文件。配置編輯器在不做任何修改的情況下給出簡單的.config文件的錯誤 – Nullqwerty 2012-02-22 16:47:17
其他人看到任何可能是錯的? – Nullqwerty 2012-02-22 18:16:18