tags:

views:

44

answers:

1

I am at a loss... not sure exactly why this is happening. I have gone through at least 50 pages in Google and scoured StackOverflow for this answer. When I run this code I keep getting the error message:

"There was a an error while trying to deserialize parameter http://tempuri.org/:message. The InnerException message was 'There was an error deserializing the object of type Application.Interfaces.Mail.MailMessage. 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.'"

Here is what I have on the WCF service (server):

<system.serviceModel>
  <services>
    <service behaviorConfiguration="SimpleServiceBehavior" name="Application.Services.Mail.Mailer">
      <host>
        <baseAddresses>
          <add baseAddress="http://myapp.com/"/&gt;
        </baseAddresses>
      </host>
      <endpoint bindingConfiguration="BasicHttpBinding_IMailer" bindingName="BasicHttpBinding_IMailer" binding="basicHttpBinding" address="http://myapp.com/" contract="Application.Services.Local.Mail.IEmailer">
        <identity>
          <dns value="myapp.com"/>
        </identity>
      </endpoint>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="SimpleServiceBehavior">
        <serviceMetadata httpGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IMailer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="800000" maxBufferPoolSize="800000" maxReceivedMessageSize="800000" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="800000" maxStringContentLength="800000" maxArrayLength="800000" maxBytesPerRead="800000" maxNameTableCharCount="800000" />
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
          <message clientCredentialType="UserName" algorithmSuite="Default"/>
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
</system.serviceModel>

And what I have on the client side:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="BasicHttpBinding_IMailer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="5242880" maxBufferPoolSize="524288" maxReceivedMessageSize="5242880" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
        <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
        <security mode="None">
          <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
          <message clientCredentialType="UserName" algorithmSuite="Default"/>
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint address="http://myapp.com/Mail/Mailer.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMailer" contract="Interfaces.Mail.IEmailer" name="BasicHttpBinding_IMailer"/>
  </client>
</system.serviceModel>
A: 

Not 100% sure if that's the problem - but you definitely have some fishy thing going on with your addresses....

In your server config you have:

<baseAddresses>
     <add baseAddress="http://myapp.com/"/&gt;
 </baseAddresses>

and

  <endpoint bindingConfiguration="BasicHttpBinding_IMailer" 
            bindingName="BasicHttpBinding_IMailer" binding="basicHttpBinding" 
            address="http://myapp.com/" 
            contract="Application.Services.Local.Mail.IEmailer">

yet in your client side config, you use

<client>
    <endpoint address="http://myapp.com/Mail/Mailer.svc"  ... />
</client>

So what is your address, really? If you're hosting your WCF service in IIS, I don't think you even need anything in your server-side config - neither a <baseAddresses> nor the address= on the endpoint will really have much say in what the service address looks like - it will be determined by your server name and name of the virtual directory and the name and extension of that *.svc file contained in it.

But these misleading addresses could lead to a misconfiguration, so that your real, actual endpoint doesn't get any custom setting, but will use the default settings instead....

Try to clean up your server side config - does that help at all??

marc_s
What's strange is that I have an ASP.NET MVC app using that exact client configuration and it is working. Its only since I created the WinApp-- which has problems.
Josh Barker
I haven't cleaned it up yet, and ended up going another route with it, due to a deadline. However, I am sure this would be part of the solution.
Josh Barker