Solved

Strange 20 MB file transfer limit using a web service

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
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…
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.

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now