Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7941729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:45:21+00:00 2026-06-03T23:45:21+00:00

Found the answer here (last post): http://social.msdn.microsoft.com/Forums/eu/wcf/thread/f5c0ea22-1d45-484e-b2c0-e3bc9de20915 I’m having one last issue with the

  • 0

Found the answer here (last post): http://social.msdn.microsoft.com/Forums/eu/wcf/thread/f5c0ea22-1d45-484e-b2c0-e3bc9de20915

I’m having one last issue with the implementation of my custom (TextOrMtomEncoder), which is the implementation of ReaderQuotas.

I’ve searched the web a lot, but I can’t figure out the final piece of the puzzle.

I’ve got a class, which contains my implementations of the ‘BindingElementExtensionElement’ and ‘MessageEncodingBindingElement’.

The MessageEncodingBindingElement implementation contains an override for:

T GetProperty<T>(BindingContext context)

which I ‘borrowed’ from the default .NET MessageEncoding implementations, like the TextMessageEncoding.

This has to be the right implementation, because MSDN says so.

The configuration is loaded fine from the web.config, I can see the ReaderQuotas properties in both my classes are set correctly, but it looks like .NET isn’t reading the ReaderQuotas config from my MessageEncodingBindingElement implementation.

My guess is .NET uses the GetProperty method to load the config, because MessageVersion is requested via this method. But the problem is, T is never equal to XmlDictionaryReaderQuotas, so the ReaderQuotas is never begin requested.

The root of my question is weird btw, I’m developing on a Windows 7 x64 machine with IIS7.5. Posting ‘large’ files (like 100 KB) works on my machine. But when I deploy the service to Windows Server 2008 R2 (tried 2 different servers), I get the following error:

The formatter threw an exception while trying to deserialize the
message: There was an error while trying to deserialize parameter
http://socialproxy.infocaster.net:argument. The InnerException message
was ‘There was an error deserializing the object of type
System.Object. 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 1584.’.
Please see InnerException for more details.

And like I said, it works on my machine :-/

Could anybody tell me how I can resolve this?

Many thanks in advance!

The WCF service config:

<system.serviceModel>
    <extensions>
        <behaviorExtensions>
            <add name="wsdlExtensions" type="WCFExtras.Wsdl.WsdlExtensionsConfig, WCFExtras, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
            <add name="textOrMtomMessageBehavior" type="InfoCaster.SocialProxy.lib.TextOrMtom.TextOrMtomMessageBehavior, InfoCaster.SocialProxy" />
        </behaviorExtensions>
        <bindingElementExtensions>
            <add name="textOrMtomEncoding" type="InfoCaster.SocialProxy.lib.TextOrMtom.TextOrMtomEncodingElement, InfoCaster.SocialProxy" />
        </bindingElementExtensions>
    </extensions>
    <bindings>
        <customBinding>
            <binding name="TextOrMtomBinding">
                <textOrMtomEncoding messageVersion="Soap11">
                    <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="204800000" maxBytesPerRead="5242880" maxNameTableCharCount="5242880" />
                </textOrMtomEncoding>
                <httpTransport maxBufferSize="5242880" maxReceivedMessageSize="5242880" transferMode="Buffered" authenticationScheme="Anonymous" />
            </binding>
        </customBinding>
    </bindings>
    <services>
        <clear />
        <service name="InfoCaster.SocialProxy.SocialProxy" behaviorConfiguration="InfoCaster.SocialProxy.ISocialProxyServiceBehavior">
            <endpoint name="SocialProxyServiceEndpoint" address="" binding="customBinding" bindingConfiguration="TextOrMtomBinding" contract="InfoCaster.SocialProxy.ISocialProxy" behaviorConfiguration="InfoCaster.SocialProxy.ISocialProxyEndpointBehavior" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <clear />
            <behavior name="InfoCaster.SocialProxy.ISocialProxyServiceBehavior">
                <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
                <serviceMetadata httpGetEnabled="true" />
                <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
        <endpointBehaviors>
            <clear />
            <behavior name="InfoCaster.SocialProxy.ISocialProxyEndpointBehavior">
                <textOrMtomMessageBehavior />
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:45:22+00:00Added an answer on June 3, 2026 at 11:45 pm

    Found the answer here (last post): http://social.msdn.microsoft.com/Forums/eu/wcf/thread/f5c0ea22-1d45-484e-b2c0-e3bc9de20915

    Ok, I found it. You have to pass the readerquotes to the standard encoders. Unfortunantly there’s no constructor for this so you have to set the property.

    class TextOrMtomEncoder : MessageEncoder   {
        MessageEncoder _textEncoder;
        MessageEncoder _mtomEncoder;
        public TextOrMtomEncoder(MessageVersion messageVersion, XmlDictionaryReaderQuotas readerQuotas)
        {
          TextMessageEncodingBindingElement textEncoderBindingElement = new TextMessageEncodingBindingElement(messageVersion, Encoding.UTF8);
          MtomMessageEncodingBindingElement mtomEncoderBindingElement = new MtomMessageEncodingBindingElement(messageVersion, Encoding.UTF8);
    
          readerQuotas.CopyTo(mtomEncoderBindingElement.ReaderQuotas);
          readerQuotas.CopyTo(textEncoderBindingElement.ReaderQuotas);
    
          _mtomEncoder = mtomEncoderBindingElement.CreateMessageEncoderFactory().Encoder;
          _textEncoder = textEncoderBindingElement.CreateMessageEncoderFactory().Encoder;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use the code found in the answer here: Directory.Move doesn't
I haven't found a coherent answer to my quesion here :( My server's ISP
Did some searches here & on the 'net and haven't found a good answer
I found this answer to this question https://stackoverflow.com/a/7244888/1473523 , but in my situation am
I found a comment here: http://bakery.cakephp.org/articles/PHPdiddy/2006/10/06/custom-urls-from-the-site-root That said: Just change last line. Router::connect('/ ',
I post this here as a last resort. I'm completely stuck and do not
There’s a really cool diff class hosted by Google here: http://code.google.com/p/google-diff-match-patch/ I’ve used it
I really think that here ill found my answers... I try to make a
My registering here is a strong testimony to the excellent answers I've found here
FOUND THE ANSWER MYSELF, see below... I'd like to have a very simple user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.