Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload Large Files from ASP .Net Application

I am building a website where i need a page where user can upload large video files, i have created WCF service with streaming but i am calling that WCF service from Button_Click event of web page.

I have used below mentioned article for WCF service creation

WCF Streaming

I have used streaming as it should be efficient and should not be buffered in memory of server.

Now questions

1) I am having doubts that the entire file is uploaded to the web server and then it is transferred to WCF Service server...if this is true then i am not getting advantage of streaming as well as iis and web server will be down very soon if user uploads large file or multiple user are uploading files con currently

2) Is there any other efficient way to do same operation with some other technique

Please help me ...

EDIT :

If I am not calling WCF Service method from ASP .Net code in that case also it is transferring bytes to the web server which i have checked with HTTPFox

I have checked above thing with upload control and putting one button on UI whose click event is bound to one method in code behind.

So, still i am having that confusion that how data is transferred

  1. Client Machine - Web Server (ASP .Net Application) - Service Server (WCF Service)
  2. Client Machine - Service Server (WCF Service)

NOTE : If i am putting a debug point on button_click and uploading 10 kb file it hits that in less then 1 sec. but if i am uploading 50 mb file then it is taking time.

I placed code of calling WCF service inside that button_click event

like image 840
Radhi Avatar asked Feb 15 '10 17:02

Radhi


People also ask

Is ASP.NET Max file upload size?

bydefault file upload limit set by asp.net is 20MB.

How do I upload a large file to .NET core?

You will need to right click your project in Solution Explorer, then select Add then New Item from the Context menu. Then from the Add New Item Dialog window, select Web Configuration File option and click Add Button. Finally, in the Web. Config file, set the maxAllowedContentLength setting to 100 MB as shown below.

What is the default size limitation of file upload in ASP.NET Fileupload control?

config. The property, maxRequestLength indicates the maximum file upload size of 28.6MB, supported by ASP.NET. You cannot upload the files when the FileSize property is below the maxRequestLength value.


1 Answers

1) I am having doubts that the entire file is uploaded to the web server and then it is transferred to WCF Service server...if this is true then i am not getting advantage of streaming as well as iis and web server will be down very soon if user uploads large file or multiple user are uploading files con currently

No, you're confusing stuff here. When you use WCF streaming to upload a large file, the file is being sent in chunks - in blocks of several Kbyte in size. The WCF server - running in IIS or self-hosted in a NT service or a console app - while receive those chunks and write them to disk, as they arrive.

You don't "upload the whole file to the web server" and then "transfer it" to the WCF service - the WCF service itself is receiving and handling the file - and only once.

If you host your WCF service yourself - in a console app, a Winforms app, or a Windows NT Service - there's not even any IIS or web server involved AT ALL. WCF handles it all by itself.

Using WCF streaming is probably one of the most memory efficient and one of the simplest ways to transfer large files to a server.

Check out some more example and blog posts on the topic:

  • MSDN WCF Streaming Sample
  • Data Transfer Using Self Hosted WCF Service
  • Sending Attachments with WCF
  • Progress Indication while Uploading/Downloading Files using WCF
like image 154
marc_s Avatar answered Nov 03 '22 06:11

marc_s