The best option to transport binary data is use MTOM.
I attach the address of a sample
http://www.codeproject.com/soap/MTOMWebServices.asp
Hello John,
I agree with Mariano. For ASP.NET webservice with WSE 3.0, the preferred
approach of transfering large binary data is using MTOM encoding. This is a
W3C standard for new webservice soap specification and it interopable for
multiple webservice platforms. The advantage of MTOM is that it will
transfer those binary data as raw binary stream rather than the text
encoded values as normal webservice binary transfering. Here are some web
articles introducing this:
#Optimize Large Data Transfer in Web Services with MTOM
http://blogs.digineer.com/blogs/tabraham/archive/2006/12/07/optimize-large-d
ata-transfer-in-web-services-with-mtom.aspx
#Sending files in chunks with MTOM Web Services and .NET 2.0
http://tim.mackey.ie/CommentView,guid,9603c0e9-a99e-4d6e-bfef-d4abb7ae9501.a
spx
Also, as you get the "The underlying connection was closed: An unexpected
error occurred" exception, it is likely that the ASP.NET server-side worker
thread(processing) has been timeout or the memory uploaded has exceed the
runtime limitation. For such case that you'll need to transfer large data
to ASP.NET server-side, you have to enlarge the executionTimeout and
maxRequestLength setting for your ASP.NET web application. This setting can
be configured through the <httpRuntime> elementi n web.config file:
#httpRuntime Element (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/library/e1f13641.aspx
Look at the "maxRequestLength" and "executionTimeout" attributes(for max
timeout and max upload data size), this is what you need to enlarge
according to your application scenario.
If you have any further questions on this, please feel free to post here.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.