Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Large Strings Between WCFs

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
US
I'm calling a TCP-hosted WCF from an http-hosted WCFlike this:

Client.Write_dat_File_String(BigString, FileNameString)

BigString has between 12,000 and 25,000 characters. The string passes to the WCF, which looks like this:

Public Sub Write_dat_File_String(ByVal datString As String, ByVal FileName As String) Implements IService1.Write_dat_File_String

'Write the datString to a text file (.dat)
Using writer As StreamWriter = New StreamWriter(System.Configuration.ConfigurationManager.AppSettings("ExStream_TXT_WriteFilePath") & FileName.ToString & ".dat", False)
writer.Write(datString)
End Using

End Sub


Problem is I'm getting this error:

The formatter threw an exception while trying to deserialize the message: Error in deserializing body of request message for operation 'Write_dat_File_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.

Any ideas? I've already upped the maxStringContentLength in my config files to 22008192. The above code works beautifully, so long as I have less than appx 12,000 characters in my string. Problem is, I need to pass anywhere from 30,000 to 50,000 characters.

Any help is GREATLY appreciated.

Thanks,

Jason
 
There are several attributes on the message, and you have to increase a couple of them at a time. I had this problem with an image byte array.

Code:
 <binding name="WSHttpBinding_IBarcodeGenerator" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" [b][red]maxReceivedMessageSize="2147483647"[/red][/b] messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" [b][red]maxArrayLength="2147483647"[/red][/b]
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
Lodlaiden

[blue]The doc walks in.[/blue] The good news:[green]"It's just Grumpy Old Man Syndrome."[/green] The bad news:[red]"You're not even 30."[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top