我已經看到了這個問題發佈了百萬次,但沒有任何解決方案都爲我工作...所以我來到這裏:問題與WCF的大型請求
當調用WCF服務我得到以下錯誤:
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://BlanketImportService.ServiceContracts/2011/06:request . The InnerException message was 'There was an error deserializing the object of type BlanketImport.BlanketImportRequest. The maximum array length quota (16384) has been exceeded while reading XML data. This quota may be increased by changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 44440.'. Please see InnerException for more details.
我已經在客戶端服務器上修改的readerQuotas
,並應用了bindingConfiguration標籤。
這裏的服務器配置:
<bindings>
<basicHttpBinding>
<binding name="BilagImportBinding" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="BlanketImport">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BilagImportBinding" bindingNamespace="http://BlanketImportService.ServiceContracts/2011/06" contract="BlanketImport.IBlanketImport">
</endpoint>
</service>
</services>
而且客戶端配置:
<bindings>
<basicHttpBinding>
<binding name="BilagImportBinding" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/BlanketImport/BlanketService.svc"
binding="basicHttpBinding" bindingConfiguration="BilagImportBinding" contract="BlanketServiceReference.IBlanketService"
name="BasicHttpBinding_IBlanketService" />
</client>
服務名稱是「BlanketImport」,還是位於命名空間下(如BlanketImport.BlanketImport)? 「」元素的「name」屬性的值必須是服務的名稱*名稱空間+類型名稱,否則WCF將無法找到它。 –
carlosfigueira
這是2015年,wcf配置設置仍然是我們大多數人的一個謎團。 – abhi