How do I send large file via Web Service

I want to send some videos up to my web server, but it seems that the way I'm sending them now has a limitation of 3072k (because any file larger than that fails).

Below is the code that I call from and to.  This all works fine when it comes any other file (under the 3072k file size).

The ex.message propert when the error occurs (denoted in the code snippet) is as follows:  The underlying connection was closed: An unexpected error occurred on a receive.

So, what I need is code to send a file, and then how to receive it back on the web service side.
'*** NOTE, I DIDN'T DECLARE EVERYTHING I USED BECAUSE I JUST COPIED AND PASTED THE IMPORTANT BITS ***
 
'*** ON THE WEB APP ***
<WebMethod()> _
 Public Function SendImage(ByVal aoImageByte() As Byte, ByVal asFilename As String) As String
	Dim sRet as String = ""
	Dim oImage As System.Drawing.Image = Nothing
 
	Try
		Dim oFS As IO.FileStream
		Try
			oFS = File.OpenWrite(sUploadFolder & "\" & asFilename)
			Try
				oFS.Write(aoImageByte, 0, aoImageByte.Length)
			Catch ex As Exception
				sRet = "* ERROR: " & ex.Message
			End Try
 
			oFS.Close() : oFS.Dispose() : oFS = Nothing
	Catch ex As Exception
		sRet = "* ERROR: " & ex.Message
	End Try
 
	Return sRet
End Function
 
'*** SUB BELOW IS WHAT I USE TO CALL THE WEB REFERENCE IN A VB.NET APP ***
 
'*** WEB REFERENCE ***
Dim coProcessImage As New WRProcessImages.ProcessImages
 
Private Sub SendFile
	Dim oFS As FileStream, sRet as String = ""
	
	Try
		oFS = File.OpenRead(oMyImage.Folder & "\" & oMyImage.Filename)
 
		Dim bImageByte(oFS.Length - 1) As Byte
 
		oFS.Read(bImageByte, 0, oFS.Length)
 
		'**** HERE IS WHERE I GET THE EXCEPTION EVERY TIME IF FILE SIZE IS OVER 3072k
		Try
			sRet = coProcessImage.SendImage(bImageByte, oMyImage.Filename, 0, "N")
		Catch ex As Exception
			sRet = "WEB SERVICE ERROR: " & sRet
		End Try
 
		bImageByte = Nothing
	Catch ex As Exception
		sRet = "COULD NOT OPEN VIDEO FILE.  FILENAME: " & oMyImage.Filename
	End Try
 
	oFS = Nothing
End Sub

Open in new window

MarkWThompsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

athapaCEO / CTOCommented:
Change the web.config or machine.config to increase the upload limit on iis.
Check this article.
http://www.c-sharpcorner.com/UploadFile/scottlysle/UploadwithCSharpWS05032007121259PM/UploadwithCSharpWS.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
retechguysCommented:
You might be runing into a File System limitation.  AKA NTFS file size limit vs Fat32 file size limit.
0
MarkWThompsonAuthor Commented:
Thanks!
0
MarkWThompsonAuthor Commented:
That was exactly it.  I added the snippet below to the web.config file and it worked like a charm.

Thanks!
	<system.web>
		<httpRuntime maxRequestLength="250000"/>

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.