[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Uploading a file using Web Services

Posted on 2005-05-16
21
Medium Priority
?
291 Views
Last Modified: 2010-05-18
Hello,
I am trying to set up a Web Service such that the user can upload his files from his local drives (say C:) onto a remote location.

Let's say the web service is running on a box called WS2 and the files have to be stored on a box called DATA1. How do I create this web service such that the client uploads his local files using this Web Service on WS2 on the DATA1 box.

I've found a solution where one uses an ASP file to upload a file to a given location using ADODB stream, but I wouldn't to work with ASP.

Any suggestions?

Thanks
0
Comment
Question by:angelfire58
  • 9
  • 5
  • 2
  • +2
19 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 14012244
If this is on a web page, have you considered using the HTML input tag instead of a web service?

Alternately, if this is a client-side app, you could use FTP.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 14012882
@Chaosian:

Jeff, are you talking about something like this:

Uploading Files with ASP.NET:
http://www.aspheute.com/english/20000802.asp

Bob
0
 

Author Comment

by:angelfire58
ID: 14012885
This is not through a web page.
The reason I am using this as a service is that we are centralizing our email systems. Multiple heterogenous programs are going to call this web service in order to send out emails. We also want to keep a track of all attachments sent and hence we want to store them on a separate box.

I've been looking around but haven't really found any other solutions.

Thanks again.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 14012901
If you need to stick with the Web Service route, is there a reason that the web service can't run on the box where the data is being stored?  It sure would minimize the complexity.

Bob
0
 

Author Comment

by:angelfire58
ID: 14012955
Hello Bob,
Personally, reading the file from a remote location and sending it out through email is not a problem.
The problem is picking up this file from a local drive using a Web Service and then forwarding it to this location.

The method of using ADODB Binary Stream works fine, but it errors out on large attachment files. I've also been very curious about any other methods around and apparently there isn't much.

Thanks again.
Alex
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 14012964
Bob,
That looks about like what I was thinking. But it sounds like this is a client-side app... so I'd use one of the third-party .Net FTP clients to upload the file, then call a web service to send the actual e-mail. You could pass the sender, recipient, subject and body as variables to the web service, plus an array of file names for the attachment(s) that have already been transferred using FTP...
Jeff
0
 
LVL 33

Expert Comment

by:raterus
ID: 14012971
I'm sure you could base64 encode any attachments and throw that in the XML file.
0
 

Author Comment

by:angelfire58
ID: 14014145
I've tried using base64 for XML and it works for small files but somehow errors out when I store large files on a remote location.

If however, I choose to store these large attachments locally on the same machine as that of the webservice, it works fine.

0
 
LVL 33

Expert Comment

by:raterus
ID: 14014198
could it be a timeout issue?, how large of files are we talking about?  base64 encoding bloats the original filesize quite a bit
0
 

Author Comment

by:angelfire58
ID: 14014240
It could very well be a timeout issue. The file size I'm talking about ranges from 1MB-10MB. Usually anything thats around 1MB works fine and anything above that starts giving me errors.

I've even gone on to the web.config and changed the http runtime as follows:

<httpRuntime
            executionTimeout="90"
            maxRequestLength="11264"
            useFullyQualifiedRedirectUrl="false"
            minFreeThreads="8"
            minLocalRequestFreeThreads="4"
            appRequestQueueLimit="100"
      />

This doesn't solve the problem either.
0
 
LVL 33

Expert Comment

by:raterus
ID: 14014318
How slow is the connection between these two computers?, I'd try to verify if this is really a timeout.  You may want to set it higher than 90 seconds.  You may also want to look into enforcing a max attachment size.  An ideal solution here would be to use a file transfer protocol, like FTP to get the files from one place to another, these protocols are meant to handle binary files, HTTP isn't...
0
 

Author Comment

by:angelfire58
ID: 14018561
I increased the timeout period to 300 seconds. It does not make a difference. The connection between these two computers is a t10 line so it should definitely not be a problem.

0
 
LVL 33

Expert Comment

by:raterus
ID: 14018577
well if it is not a timeout issue, what is the issue?  Can you get more details on the error raised when it fails?
0
 

Author Comment

by:angelfire58
ID: 14018612
Hello,
I use an EasyMail component to send out an email. The component returns "error opening attachment file"

On the flip side, that would mean that it does not post the file on the network location. I've tried smaller files and then refreshed the location where it posts the files and it does put it there. On larger files, the file is never posted.

Today, I am going to try bringing the web service and the DATA box (i.e. box where these attachment files are stored) on the same box to check it that would work.

Ideally it should as it did work like that before, but the question would still remain unanswered:(

Thank you

0
 
LVL 33

Expert Comment

by:raterus
ID: 14018656
I'd take the mailing part out for now, just get the files to the network computer first, then worry about emailing them.  If you say a file isn't getting there, certainly if you dig deep enough a reason can be found why.
0
 

Author Comment

by:angelfire58
ID: 14019999
I just checked the file transfer to the network computer and a local computer. Well now it's not transferring the files locally either. This local transfer still works from the other program. But my new project which copies files locally (with same code as that of the older one) does not work.

It gives me the following error message "Download of a specified resource has failed"

After doing some search on Google, I've noticed others have had this problem too, but could not find any specific solutions

Thanks
0
 

Author Comment

by:angelfire58
ID: 14021411
AspMaxRequestEntityAllowed is a setting in IIS6 that by default allows 200K I think. We changed this setting to 1GB just for test purposes. It seems to get rid of the error message "Download of a specific resource has failed" but does not transfer the file either. This is strange.

Any suggestions?
0
 

Author Comment

by:angelfire58
ID: 14046227
After a lot of research I finally solved the problem.
If you set the AspMaxRequestEntityAllowed to a value like 10MB (i.e. cap the size to the largest attachment you want to send) then it works fine.
IIS6 has the default set to a very low value and thus the XMLHTTP worked for small sized files.

IIS5 on the other hand did not have this setting and thus XMLHTTP works perfectly fine for any sized e-mails.

While MS claims that you don't have to restart IIS6 after changing this AspMaxRequestEntityAllowed attribute, I could not get it working unless I restarted IIS.

This solves my problem.

Thanks for all the support.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14284964
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

830 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