OK, I have written a method inside a web service for sending an email (not important).
Site side, i am deserializing a MailMessage object into XML (a custom routine i’ve written). This then gets passed as a parameter to the web method in the Web service. It all works fine, until a file attachment in the mail message becomes greater than around 144kb.
The XML string for the mail message ends up looking something like this (passed as a unformatted string parameter):
<MailMessage>
<To>xx.xx@Domain.com</To>
<From>NoReply@Domain.com</From>
<Body>blah blah</Body>
<Attachment ContentType="application/vnd.ms-excel" fileName="Test.xls">
<byte>00</byte>
<byte>05</byte>
<byte>6F</byte>
…etc
The highest attachment size i can succesfully receive is 144kb, anything higher than this, and the request never reaches the web service method. I know this for a fact as the first line in my web method is to log that the request was received. IIS logs show POST messages being received by the webservice (from what i can gather), yet there is no evidence of it arriving inside my web method. There are no errors, despite try catch blocks around everything i can think of.
Is there some sort of default maximum size/timeout that i’m not aware of? I’m no guru with this sort of stuff, so I imagine I am missing something trivial here.
Can anyone advise what I may be doing wrong please? I can post code examples if needed.
Increasing the value of maxMessageLength in your web.config should allow for larger soap messages to be passed to the server.
See this link for details.
Large Soap