New Posts New Posts RSS Feed: Xml Error Deserializing Object from BOS
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Xml Error Deserializing Object from BOS

 Post Reply Post Reply
Author
danielp37 View Drop Down
Newbie
Newbie


Joined: 18-Mar-2008
Location: United States
Posts: 29
Post Options Post Options   Quote danielp37 Quote  Post ReplyReply Direct Link To This Post Topic: Xml Error Deserializing Object from BOS
    Posted: 27-Mar-2008 at 9:43pm

I received the following exception when trying to execute a query through the BOS:

EntityServerException:

The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://ideablade.com/EntityModel:FetchResult. The InnerException message was 'There was an error deserializing the object . 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.'.  Please see InnerException for more details.

The Query looks like this:
 

var member = dataset.ExecuteQueryForEntity<Member>((from mem in dataset.Members

    where mem.MemberId == "754402"

    select mem).Include("ActualCoverages")

    .Include("Subaccounts")

    .Include("Subaccounts.TransferLines")

    .Include("Subaccounts.TransferLines.Payment"));

 
I tried running the query without the .Includes on it and still got the exception, except that instead of getting it when the query was executed, I got it when it tried loading a specific Payment.  The Payment object has an ntext column on it that is over 23,000 bytes long.  Could this be what's causing the exception?
 
When I remove this column, the query works.  Should this be a limitation of the BOS?
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2008 at 9:57am
First, I'm sorry for the late reply, but I somehow missed this and a few other posts.
 
For the "standard" BOS configuration - one that uses only the DevForce section config settings or the web.config sample we've provided - we set various quotas to maximum values.  Unfortunately, the MaxStringContentLength ReaderQuota is not something we currently set, but I've opened a bug report to address this.
 
The workaround is to change the reader quotas on the binding via the config file.  If you're hosting your BOS in IIS, this is easy to do, since the system.ServiceModel configuration section is defined in the web.config.  If you're hosting in either the console or service applications provided with DevForce, this is a little harder since you're probably not using a serviceModel configuration section.  I can provide a sample upon request.
 
Here's the binding change:
 
    <bindings>
      <customBinding>
        <binding name="compressedBinaryBinding">
          <gzipMessageEncoding>
            <readerQuotas
                  maxArrayLength="2147483647" maxDepth="2147483647"
                  maxStringContentLength="your limit"
            />
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647"/>
        </binding>
      </customBinding>
    </bindings>
 
Back to Top
danielp37 View Drop Down
Newbie
Newbie


Joined: 18-Mar-2008
Location: United States
Posts: 29
Post Options Post Options   Quote danielp37 Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2008 at 11:02am
We are currently using the Console BOS and plan on using the Service BOS so I would need to make these changes in the system.ServiceModel configuration section and would appreciate a sample.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2008 at 1:14pm
Here's a sample serviceModel configuration section for the server.  You can place the section in the exe's config file, or the app.config embedded in the AppHelper project.  The ideaBlade.v4 configuration section is still needed, although the objectServer element will be ignored.  The serviceModel and ideaBlade.v4 sections do not need to be in the same config file.  So, for example, you could place the serviceModel section in a ServerConsole.v4.exe.config file, and leave the ideaBlade.v4 section in the AppHelper project.
 
 
<?xml version="1.0" encoding="utf-8"?>

<!-- Sample server-side configuration, showing defaults -->
<configuration>

  <system.serviceModel>
    <services>
      <service name="EntityService">
        <endpoint
       address="http://localhost:9009/EntityService"
       binding="customBinding" bindingConfiguration="compressedBinaryBinding"
        contract="IdeaBlade.EntityModel.v4.IEntityServiceContract" />
      </service>
      <!-- One EntityServer service per data source extension -->
      <service name="EntityServer">
        <endpoint
       address="http://localhost:9009/EntityServer"
       binding="customBinding" bindingConfiguration="compressedBinaryBinding"
            contract="IdeaBlade.EntityModel.v4.IEntityServerContract" />
      </service>
    </services>

    <bindings>
      <customBinding>
        <binding name="compressedBinaryBinding">
          <gzipMessageEncoding>
            <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647" />
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647"/>
        </binding>
      </customBinding>
    </bindings>

    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="IdeaBlade.Util.Wcf.Extensions.v4.GZipMessageEncodingElement, IdeaBlade.Util.v4"/>
      </bindingElementExtensions>
    </extensions>
   
  </system.serviceModel>

</configuration>

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 08-Apr-2008 at 1:18pm
Here's a sample for the client side.  The configuration information on the two sides needs to agree, so that the communications channel can be opened and data sent and received correctly. 
 
You have the same options for placement of the serviceModel and ideaBlade.v4 sections as with the server.
 
<?xml version="1.0" encoding="utf-8"?>
<!-- Sample client-side configuration, showing defaults -->
<configuration>
 <system.serviceModel>
  <client>
   <endpoint name="EntityService"
        address="http://localhost:9009/EntityService"
        binding="customBinding" bindingConfiguration="compressedBinaryBinding"
        contract="IdeaBlade.EntityModel.v4.IEntityServiceContract"
    />
    <!-- One EntityServer endpoint per data source extension -->
   <endpoint name="EntityServer"
        address="http://localhost:9009/EntityServer"
        binding="customBinding" bindingConfiguration="compressedBinaryBinding"
        contract="IdeaBlade.EntityModel.v4.IEntityServerContract"
    />
  </client>
    <bindings>
      <customBinding>
        <binding name="compressedBinaryBinding">
          <gzipMessageEncoding>
            <readerQuotas maxArrayLength="2147483647" maxDepth="2147483647"/>
          </gzipMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647"/>
        </binding>
      </customBinding>
    </bindings>
    <extensions>
      <bindingElementExtensions>
        <add name="gzipMessageEncoding" type="IdeaBlade.Util.Wcf.Extensions.v4.GZipMessageEncodingElement, IdeaBlade.Util.v4"/>
      </bindingElementExtensions>
    </extensions>
  </system.serviceModel>
</configuration>
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down