0
votes


When hosting a WCF service in IIS 7.5 (W2008) we sometimes get an error on the client saying:

"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:defaultText. The InnerException message was 'There was an error deserializing the object of type System.String. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 148, position 106.'. Please see InnerException for more details."

So we changed the MaxStringContentLength attribute of the readerQuotas element of the basicHttpBinding in the web.config on the server. But apparently the service is ignoring everything in the system.serviceModel section! If the system.serviceModel section is delete IIS is still serving a default basicHttpBinding.

I have found more articles on this problem, for instance: http://social.msdn.microsoft.com/Forums/vstudio/en-US/2f990dec-79f5-4943-b238-44f0321148c3/changes-to-services-bindings-have-no-effect-wcf-iis-7-vs2010-net-401

but i don't understand the answers. Does anyone know how to make IIS/WCF listen to the web.config?

many thanks in advance!

2

2 Answers

0
votes

I know certain sections of web.config are ignored unless your app pool is running in "Integrated" managed pipeline mode...

0
votes

I solved it by creating "unnamed" bindings:

In .NET 4, configuration has been significantly simplified. For example, if you create a binding tag without a name attribute, it will be applied to all bindings of the same kind:

<binding someConfig="someValue"/>

You can also use protocol mapping to configure the default binding used for a particular scheme. For example:

<add scheme="http" binding="webHttpBinding"/>