Solved

Strange 20 MB file transfer limit using a web service

Posted on 2006-10-31
3
944 Views
Last Modified: 2012-06-21
We have created a web service that transfers files over http.  It does this by reading the file and returning the file object via a soap message.  This web service is installed on a windows 2003 server running IIS 6.0.  The web service works well with smaller file sizes but as soon as you attempt to transfer a file larger than 20 MB, it downloads the first 20 MB and then stops with no errors.  The web service learns the path to the file via a third party SQL database and then accesses the files via a windows file share, for example - \\servername\sharename\filename.txt.  This web service is working without these issues in our staging and development environments.  This only happens in production.

Now for some of the strangeness.  First, we tried installing the web service on a windows XP Pro computer and it works fine with files larger than 20 MB.  We then tried changing the path in the SQL database to use the local drive letter instead of a file share, for example - F:\folder\filename.txt.  That seems to have solved the issue in production but we are not able to make that change permanently to the paths due to the third party app that uses them.  This is making us think that the issue is in the method of transfer somehow but we are at a loss as to why.

Here is the code in the web service.

<WebMethod()> _

   Public Function getImageByPath(ByVal filePath As String) As [Byte]()

        Dim fs As FileStream

        Try

            ' Read file and return contents

            fs = File.Open(filePath, FileMode.Open, FileAccess.Read)

            Dim lngLen As Long = fs.Length

            Dim abytBuffer(CInt(lngLen - 1)) As Byte

            fs.Read(abytBuffer, 0, CInt(lngLen))

            Return abytBuffer

        Catch exp As Exception

            Return Nothing

        Finally

            If Not fs Is Nothing Then

                fs.Close()

            End If

        End Try

    End Function

0
Comment
Question by:denverjaye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 11

Expert Comment

by:kmartin7
ID: 17845552
We had a similar issue with an application we created for the military. The problem was they had several reverse proxies that limited the transfer to a pre-specified amount (varied depending on owner). The real problem was there were few people that knew of the problem and it was difficult to find since they all had a different size limitation. We had to re-develop the application so that it sent compressed, 5MB chunks of data that decompressed and recompiled at the receive site. Not exactly the same issue, but maybe it might help shed some light on your issue.
0
 
LVL 1

Expert Comment

by:rajeev1972
ID: 17850910
In place of giving
\\servername\sharename\filename.txt

put

\\ip address\sharename\filename.txt

0
 
LVL 1

Accepted Solution

by:
gderoeck earned 500 total points
ID: 17863916
I ran into an issue in a .NET application a while back where file transfers were getting terminated before the entire transfer was completed.  I was finally able to resolve the issue by using a FileStream, BinaryReader and BinaryWriter to perform the transfer, rather than just using the File.Open method you're using above.  The next step, as mentioned above, would be to buffer the transfer to smaller chunks to make the transfer more manageable.

Microsoft goes into some detail on Streams and how they interface with the Backing Store, whether it be a hard drive, network location, or memory.  You can find that article at:   http://msdn2.microsoft.com/en-us/library/e4y2dch9.aspx 
0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question