Solved

Strange 20 MB file transfer limit using a web service

Posted on 2006-10-31
3
930 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…

856 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