I have a WCF application. Which extract value from a txt file and save into database. When the file size is upto 16KB then its working fine. When when its goes above 16KB the the Service throws an error.
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:f. The InnerException message was 'There was an error deserializing the object of type System.Byte[].
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 24597.'. Please
see InnerException for more details.
In the web.config : MaxArrayLength property is set to 2147483647
But in the binding if i remove messageEncoding="Mtom" then following error occurs:
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (413) Request Entity Too Large.
But in the binding if i remove messageEncoding="Mtom" then following error occurs:
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (413) Request Entity Too Large.
Does it works as expected before you remove this?
How do you host the service? If you host the service in IIS, you may take a look at a post
here to check if the issue is related to IIS request readquota setting. Another post talks on similar issue.
No, before i remove that follwing error was there :
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:f. The InnerException message was 'There was an error deserializing the object of type System.Byte[].
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 24597.'. Please
see InnerException for more details.
I had made a site in my IIS and hosted my WCF application there. Is there any option so that i can attched the project so that you can run my sample code there.
arijit.manda...
Member
14 Points
24 Posts
The formatter threw an exception while trying to deserialize the message in WCF
Jan 29, 2013 04:58 AM|LINK
I have a WCF application. Which extract value from a txt file and save into database. When the file size is upto 16KB then its working fine. When when its goes above 16KB the the Service throws an error.
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:f. The InnerException message was 'There was an error deserializing the object of type System.Byte[]. 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 24597.'. Please see InnerException for more details.
In the web.config : MaxArrayLength property is set to 2147483647
kushalrdalal
Contributor
7130 Points
1273 Posts
Re: The formatter threw an exception while trying to deserialize the message in WCF
Jan 29, 2013 09:22 PM|LINK
Try setting up MaxArrayLength = 2147483647 in your web config file of your wcf service.
My Blog
LinkedIn Profile
Haixia Xie -...
Contributor
3030 Points
296 Posts
Microsoft
Re: The formatter threw an exception while trying to deserialize the message in WCF
Jan 30, 2013 01:11 AM|LINK
Hi,
Please make sure you have apply the bindingconfiguration to your endpoint for both service and client side.
If the issue still exists, please post your config here.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
arijit.manda...
Member
14 Points
24 Posts
Re: The formatter threw an exception while trying to deserialize the message in WCF
Jan 30, 2013 04:22 AM|LINK
Hi kushalrdalal
Thanx for ur comment but I had already mention that in web.config i had written MaxArrayLength = 2147483647. I does't works.
arijit.manda...
Member
14 Points
24 Posts
Re: The formatter threw an exception while trying to deserialize the message in WCF
Jan 30, 2013 04:29 AM|LINK
Hi Haixia Xie,
This is my web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISwiftBacsService" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="00:10:00" transferMode="Streamed" openTimeout="00:10:00" sendTimeout="00:10:00" messageEncoding="Mtom">
<readerQuotas maxDepth="32"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"
/>
<security mode="None"></security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.26:8082/SwiftBacsService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISwiftBacsService"
contract="SwiftBacsWcfService.ISwiftBacsService" name="BasicHttpBinding_ISwiftBacsService" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="clintbihaviour">
<dataContractSerializer maxItemsInObjectGraph ="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<httpRuntime maxRequestLength="65536"/>
</system.web>
But in the binding if i remove messageEncoding="Mtom" then following error occurs:
System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (413) Request Entity Too Large.
Haixia Xie -...
Contributor
3030 Points
296 Posts
Microsoft
Re: The formatter threw an exception while trying to deserialize the message in WCF
Feb 05, 2013 12:59 AM|LINK
Hi,
Does it works as expected before you remove this?
How do you host the service? If you host the service in IIS, you may take a look at a post here to check if the issue is related to IIS request readquota setting. Another post talks on similar issue.
#(413) Request Entity Too Large
http://www.codeproject.com/Articles/521725/413-Request-Entity-Too-Large
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
arijit.manda...
Member
14 Points
24 Posts
Re: The formatter threw an exception while trying to deserialize the message in WCF
Feb 05, 2013 05:40 AM|LINK
Hi Haixia,
No, before i remove that follwing error was there :
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:f. The InnerException message was 'There was an error deserializing the object of type System.Byte[]. 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 24597.'. Please see InnerException for more details.
I had tried to increase the uploadreadaheadsize in iis7 but unable to execute the command(According to the instruction http://www.codeproject.com/Articles/521725/413-Request-Entity-Too-Large) successfully.
I had made a site in my IIS and hosted my WCF application there. Is there any option so that i can attched the project so that you can run my sample code there.
Haixia Xie -...
Contributor
3030 Points
296 Posts
Microsoft
Re: The formatter threw an exception while trying to deserialize the message in WCF
Feb 06, 2013 12:28 AM|LINK
Hi,
You can upload the simplified project to skydrive and post the link here and provide the steps on how do you host the application in IIS.
Best Regards.
Feedback to us
Develop and promote your apps in Windows Store
arijit.manda...
Member
14 Points
24 Posts
Re: The formatter threw an exception while trying to deserialize the message in WCF
Feb 13, 2013 04:05 AM|LINK
Hi,
Its done..I had changed the Binding Type from basicHttpBinding to WSHttpBinding and its working fine.