WCF length quota (16384) has been exceeded while reading XML data.
- From: "GaryDean" <gdeanblakely@xxxxxxxxxxxxxxxx>
- Date: Mon, 10 Nov 2008 15:34:18 -0700
This problem is all over the internet. However I have yet to see a single
straight answer.
My service works fine until I start passing a large byte[] and it gets this
error. My solution consists of a WCF Service Library hosted by IIS. My WCF
Service Library has an app.config and the hosting website has a Web.config.
They are both pasted at the end of this post. I saw a solution, on A poster
in a WCF forum that mentioned the following entries could be used:
<bindings>
<netTcpBinding>
<binding name="netTcp"
maxReceivedMessageSize="2147483647"
maxConnections="2147483647">
<readerQuotas
maxDepth="64"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096"
maxNameTableCharCount="16384"/>
</binding>
</netTcpBinding>
</bindings>
However the poster failed to say WHERE to put these entries and WHICH CONFIG
FILE the entries go in. This example is for netTcpBinding and I am using
IIS 6 so I am using basic binding. Other than not knowing where to put the
above entries I'm not entirely sure how to specify those entries for my
basic binding. I don't know, for instance, what to specify in the name=
line.
Would it be possible to find out what entries need to be put where in what
config file to solve this problem?
Thanks,
Gary
web.config file is as follows.............................................
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="false"
logMessagesAtServiceLevel="false"
logMessagesAtTransportLevel="false" />
</diagnostics>
<services>
<service behaviorConfiguration="ServiceBehavior"
name="VtaxDataService.VtaxDataService">
<endpoint address="" binding="wsHttpBinding"
contract="VtaxDataService.IVtaxDataService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
<endpoint address="basic" binding="basicHttpBinding"
contract="VtaxDataService.IVtaxDataService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
app.config file is as follows.....................................
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Verbose,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type="" />
</add>
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Verbose,ActivityTracing"
propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\documents and settings\administrator\my
documents\visual studio
2008\projects\vtaxdataservice\vtaxdataservice\app_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener"
traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="c:\documents and settings\administrator\my
documents\visual studio
2008\projects\vtaxdataservice\vtaxdataservice\app_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<appSettings>
<add key="LogEvents" value="c:\\temp\\WCFLogger.txt"/>
<!-- this is mandatory & must contain file name-->
</appSettings>
<connectionStrings>
<add name="xxxxConnectionString" connectionString="user id=xx;data
source=xxxx;password=xxxx;initial catalog=VTDB;persist security info=True"
providerName="System.Data.SqlClient"/>
<add name="LocalSqlServer" connectionString="user id=xxxx;data
source=xxx;password=xxxx;initial catalog=xxxxx;persist security info=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config
file must be added to the host's
app.config file. System.Configuration does not support config files for
libraries. -->
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
<services>
<service behaviorConfiguration="VtaxDataService.Service1Behavior"
name="VtaxDataService.VtaxDataService">
<endpoint address="" binding="wsHttpBinding"
contract="VtaxDataService.IVtaxDataService" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
<endpoint binding="basicHttpBinding"
contract="VtaxDataService.IVtaxDataService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8877/VtaxDataService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="VtaxDataService.Service1Behavior">
<!-- 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="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
.
- Follow-Ups:
- RE: WCF length quota (16384) has been exceeded while reading XML data.
- From: "Steven Cheng"
- RE: WCF length quota (16384) has been exceeded while reading XML data.
- Prev by Date: Re: Debugging WCF apps
- Next by Date: Re: XPathNavigator
- Previous by thread: Webrequest authentication.
- Next by thread: RE: WCF length quota (16384) has been exceeded while reading XML data.
- Index(es):
Relevant Pages
|