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
Related
I am getting System.OutOfMemoryException when I run crystal report on web application because of huge file.
To solve this issue I am trying to increase the size of Caching memory on IIS.
I saw on this Stack overflow to increase the size. But for me it is disable to change the size like below pic
.
You can configure the caching setting at the server level in the ApplicationHost.config file or at the site, application, or at the directory level in a Web.config file, using <caching> section.
For example, the following code example sets the maximum output cache size to 1 gigabyte and sets the maximum size of a response that can be stored in the output cache to 512 kilobytes.
<configuration>
<system.webServer>
<caching enabled="true" enableKernelCache="true" maxCacheSize="1000" maxResponseSize="512000"/>
</system.webServer>
</configuration>
NB
The element is included in the default installation of IIS 7 and higher.
I hope that my answer could help you to achieve your aim. This link contains a lot of nitty-gritty details and more detailed explanation.
I am migrating a website which is/will be running on IIS and I will be using rewrite maps to 301 redirect old ".asp" URLs to a new style of URL. For many thousands of URLs there is no pattern, so it appears I must rely on rewrite maps.
My problem is that the default web.config size limit is 250kb, and in my environment, I don't have access to change this (as can be done at the registry level - if one had access).
I have looked into moving the rewriteMaps section to an external file, but the external files also have the default size limit of 250kg, so this is also not going to work.
I am looking for some other way to handle this... I am sitting at 242kb currently and have over twice the amount of old to new redirect mapping to add.
Thanks in advance.
As I am in a shared environment, there was no solution other than to move it to a single external config file, which was again, limited to 250KB.
So here is what I did:
I filled up the map to capicity with the highest-trafficked redirects and of course any groups of urls that could be redirected using a pattern (so they would be fastest).
For the 100k remaining long-tail of the redirects, I put them into a REDIRECTS table in the db... SO, after the request passes all of the rewrite rules in the file (and of course, doesn't hit any), it defaults the request to a certain script. One of the first things the script does is check the REDIRECTS table, and if an entry exists, I do a redirect in the code... it's slower, but most of the stuff in the table is long tail, and as I said, the most visited redirects are still in the file. This has worked well for me so far, and I can add as many redirects as I want... e.g. if a page title/url gets edited, my admin area automatically adds the redirect, etc.
The Nativerd.dll file uses the value of this registry key to determine the maximum allowed size, in KB, of the Web.config files. The Configuration system assumes a default value of 250 KB in Windows Server 2008 and 100 KB in the release version of Windows Vista.
The reason for the 250KB limit is to reduce attacks for uploading a large web.config file. You can change the the limit by altering the upper value in your registry:
HKLM\SOFTWARE\Wow6432Node\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB (REG_DWORD)
See: Description of the registry keys that are used by IIS 7.0, IIS 7.5, and IIS 8.0
Another option is to split your web.config files into multiple smaller files.
We were stuck on this for a long while, we ended up writing our own 301 redirector. In sitecore it was in a pipeline patched after ItemResolver which consumes the large file (not included in any Web.configs). We could not use the "registry hack" option as it an Azure Service App and there is no (easy and cheap) access to the registry.
You can split up your configuration into a few different files as Neill said.
You will have a main web.config file in which you’ll reference sub config files by adding a configSource attribute onto the sections you would like to split into other files.
For example, if you’d like to split the section “appsettings” in another file, you would change the appSettings section in your web.config file to :
<appSettings configSource="appsettings.config" />
and in the appsettings.config file, you would add all your appsettings entries like they were in the original web.config file, for example;
<appSettings>
<add key="aspnet:RestrictXmlControls" value="true" />
<add key="FeedCacheTime" value="300" />
<add key="FeedPageUrl" value="/_layouts/15/feed.aspx?" />
<add key="FeedXsl1" value="/Style Library/Xsl Style Sheets/Rss.xsl" />
<add key="aspnet:AllowAnonymousImpersonation" value="true" />
</appSettings>
Obviously with the rewrite maps instead.
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 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 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.