i am using fileuploader, i got its code from
http://www.codeproject.com/KB/aspnet/Implementing_HTTP_File_Up.aspx
and its working fine with small size files but its showing me bellow text when i try to upload a large file. my file size can be of 8-10 mb.:
The connection was reset
The connection to the server was reset while the page was loading.
* The site could be temporarily unavailable or too busy. Try again in a few
moments.
* If you are unable to load any pages, check your computer's network
connection.
* If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.
please tell me what should i do.
You could try increasing the maximum request length in web.config:
<configuration>
<system.web>
<!-- The value is in KB -->
<httpRuntime maxRequestLength="4096" />
</system.web>
</configuration>
Alongside the answer Darin Dimitrov has given, you might also have to change the setting in iis for your web-application. If you are using Sharepoint, you need to configure it also in SCA.
Related
I work on a VS2012 MVC4 project containing a Web API controller. This project will be published on an IIS server.
I need to allow users to upload files. The problem is a web API is limited up to 4MB maximum file size upload. I read (for example here: http://blogs.msdn.com/b/henrikn/archive/2012/03/01/file-upload-and-asp-net-web-api.aspx) that we can extend this limitation by self hosting the web API (in this case file upload up to 2GB). I don't want self host my webAPI because I want to host it on my IIS web server so I think this is not suitable for my situation, right? So what can I do for uploading files bigger than 4MB?
If possible I search for an HTML5 solution (with drag'n drop).
So far none of the solutions I found allows me to accomplish this.
Thanks for your help.
Probably it was not clear but actually the blog URL is referring to IIS. You need to look for the following 2 settings in Web.config to increase the upload size:
Note maxRequestLength is in kbytes:
<system.web>
<httpRuntime targetFramework="4.5" maxQueryStringLength="" maxRequestLength="" maxUrlLength="" />
Note maxAllowedContentLength is in bytes:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="" maxQueryString="" maxUrl=""/>
If you read it carefully, it says "ASP.NET has a maximum limit of 2G in terms of file size that you can upload." So basically when hosted in ASP.NET/IIS you will be able to receive files up to 2Gbs. What you have to do is change some default values in web.config.
Check this out: https://stackoverflow.com/a/7154363/2517785
You can check this
int MaxContentLength = 1024 * 1024 * 10; //Size = 10 MB
if (postedFile.ContentLength > MaxContentLength)
{
}
I know this question has been asked in other threads, but none of the solutions provided could fix my problem.
When I upload a file greater than ~4MB (i.e. bigger than default), I get the "Internet Explorer cannot display the webpage" error. (Files smaller has no problems).
Here's what I've done so far:
1) Edited webconfig:
<httpRuntime maxRequestLength="20480" executionTimeout="3600" enable="true"/>
<customErrors mode="Off"></customErrors>
AND
<requestLimits maxAllowedContentLength="20000000000" />
2) Updated hosts file (C:\Windows\System32\drivers\etc\hosts) to remove line:
:: 1 localhost
3) Tested on IE, Chrome, and Firefox (all have the same issues).
4) Tried using IE's developer tools but not quite sure what to look for.
Would really really appreciate any advice/guidance on this! I've spent almost 2 days on this and still cannot figure it out. I gather it must be the file size issue (since I have load smaller files...)
THANKS so much!
Assuming that you have file upload control as follows:
<asp:FileUpload ID="flUpImg" runat="server"/>
when uploading is done you usually upload files to the server by clicking a button.
In that button click event check for
flUpImg.PostedFile.ContentLength
let xxxx be the value returned.
Note it down and stop debugging.
Go to web.config file and edit the following tag as
<httpRuntime maxRequestLength="value greater than xxxx"/>
where xxxx is the size of the uploaded files.
Two more things to look at:
1) Are you running UrlScan or some other IIS add-in? You can check through the IIS console by choosing your web-site and clicking ISAPI Filters. If so, check whether it too has an upload size limit that you need to override: e.g., C:\Windows\System32\inetsrv\urlscan\urlscan.ini, [RequestLimits], MaxAllowedContentLength=1073741824.
2) Check your global .config files: machine.config and root-level web.config in e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config (for 64-bit applications running .NET 4) for <system.web /> and applicationHost.config in C:\Windows\System32\inetsrv\config for <system.webServer /> in case there are any non-standard settings in there such as allowDefinition="MachineOnly" or allowOverride="false". I suspect this isn't the problem, as you would probably see some sort of message on the screen or in the application event log if it were; something else to tick off your list, though.
I was facing the same issue which got resolved by adding below in web.config under system.web.
<httpRuntime maxRequestLength="20480" executionTimeout="3600" enable="true"/>
The key is the maxRequestLength="20480" inside your <httpRuntime> tag. It's failing because the page is rejecting the file you're testing, which is evidently larger than 20MB. If you check the file you're testing you'll probably notice this.
Try setting this figure a lot higher and you will get some success!:
<httpRuntime maxRequestLength="51200" executionTimeout="3600" enable="true"/>
I want to upload a large file in asp.net app of visual studio 2010. But I have got connection reset error. How can I solve it? Thanks.
P.S I have changed the requestlimited in the webconfig which is not to be make any effect.
It's a security setting to limit the size of the request. It's a setting called RequestMaxLength in web config. I believe the default is 3 or 4 MB... An asp.net file upload will be limited by the number defined in this setting (any request for that matter).
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" executionTimeout="1200" />
</system.web>
</configuration>
It's not wise to make this a very large number because it exposes you to DOS attack since someone could just flood your server with huge files. There is also an executionTimeout property that might have to be set as well
I'm using the Media module to upload a file in Orchard. If I select a file of 2.2MB it works, however if I try to upload a bigger file (let's say a 4MB movie) I get an error page saying that 'This page is not available'.
Is there a size limit and if yes how can I increase it?
Thanks!
You can set that in root Orchard Web.config file (it's in the Orchard.Web project if you are working with the full source). By default ASP.NET has a 4MB limit for size of POST request.
<system.web>
<httpRuntime maxRequestLength="1024000" executionTimeout="360"/>
</system.web>
Above will set max request size to 1 GB.
You can read more about that here, here and here.
An additional note to Piotr's answer: maxRequestLength's value is in KBs, so maxRequestLength should be 1024000 for a GB (the answer above shows 102MB).
For those using Azure and the ClickToBuildAzurePackage.cmd from the source: You'll need to modify the src\Orchard.Azure\Orchard.Azure.Web\Web.config file with maxRequestLength. This is because the packager will overwrite the Web.config in the src/Orchard.Web/Web.config with this file. Or technically you can make the build and modify the web.config file after and repackage, but I personally haven't gotten Azure to successfully take my "rezipped" package.
When uploading large files to Orchard via http over ADSL, another setting that I needed to change was the connection timeout, which has a default of 120 seconds. This seems to override the settings discussed here and caused the connection to be reset. In IIS7 this is under the 'Limits...' section on the right hand side, for the specific site node, or 'set Web Site Defaults...' on the sites node.
The config section is:
<system.applicationHost>
<sites>
<siteDefaults>
<limits connectionTimeout="00:20:00" />
</siteDefaults>
</sites>
</system.applicationHost>
See also iis.net documentation
I have a page on my ASP.NET site which uploads files.
I have attempted to tweak the web.config file to allow for larger uploads.
In my web.config, I set:
<httpRuntime maxRequestLength="2097152" executionTimeout="3600" />
On my page, when I attempt to upload smaller files, no issue...even at 25MB.
However, when I attempt to upload a 50MB file, I still get a 404 error page.
NOTE: I have a flash control on a different page which can upload almost 2gb with no issues, using this same web.config setting.
Same result on different PCs, same result when posted to different web servers.
My web server is Windows Server 2008 R2.
Any ideas of the cause? Why would flash be ok, but plain jane upload control have this problem?
I found the answer. Windows Server 2008 R2 is using IIS7 (of course), and in IIS7, you have to set the following in your web.config file (in my example to increase the limit to 2gb):
<system.webserver>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
<system.webserver>
This worked, when everything else didn't. IIS7 by default limits uploads to 30mb unless this override is set.
The executionTimeout applies only if the debug attribute in the compilation element is False. (see also http://msdn.microsoft.com/en-us/library/e1f13641.aspx)
So try it when starting your application in Release config.