We have a asp website to upload files Client machine(website hosted in IIS) to Server machine(website hosted in IIS) using FTP. Both client and server websites are different websites. Our clients may use any of the windows OS (i.e. XP, Win 7, Win server 2003/2008).
While testing the file upload using FTP, we sent files in various sizes from almost all the OS. Issue is, i can able to upload files only within size of 512MB through FTP (using HTML input control) from Win 7 & Win server 2008 to xp, win 7, server 2008 and if i try more 512 MB, then it throws me System.out of memory exception and in same manner only i can upload files within size of 64MB from Win XP to xp, win 7, Win server 2008 and if i try more than 64 MB, it throws me System.out of memory exception.
I need a two solution :
1) I confused at above uploading....... why i can only upload within 64 MB file From XP to any OS?(which includes XP, Win 7, Server 2008). but from Win 7& Win server 2008 to any OS i can upload upto 512MB files.
2) If i try more than 512MB 0r 64MB files it throws System.out of memory exception.?
Please advise on solving this problem.
I have following settings in my website's web.config file,
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="2097151" useFullyQualifiedRedirectUrl="false" requestLengthDiskThreshold="50000" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>
please help me.
Thanks,
Kaviyarasan
Based on the Error/Exception, it seems that its not an issue from ASP.NET. Its more of a Memory issue.
Because you've already set the Execution Timeout Time and Max Content size in your web.config file. So, I guess there is no problem at all.
But if possible, try to check the Thread enter link description here. You might get what you want. This is the same for your problem No 2.
Related
My session is getting reset after I upload file using a flash plugin. I put some logging into the Session_Start function and I see its called every time I upload a file using the flash plugin. I'm not sure what would be causing this. This is working locally for me in dev environment with the same server and settings.
I'm using
IIS 7 with Windows Server 2008 R2.
My app:
ASP.NET MVC .NET 4.0 (legacy app)
I upload other files on the site without the flash plugin and those work. This functionality worked before. But for some reason now it stopped working.
Any ideas on what could be causing this to occur?
First Microsoft End of support for Windows Server 2008 and Windows Server 2008 R2.
The default server configuration does not allow you to upload files with Flash Uploader.
You could try below settings:
1)Disabling Request Validation:
ASP.NET automatically validates a request or rejects it if there are dangerous fields. However, HTML5/Flash Uploader sends files data in text fields (instead of binary ones) due to Adobe Flash Player limitations. IIS may treat this behavior as potentially dangerous and, thus, you can get the following error during uploading:
A potentially dangerous Request. Form value was detected from the client
use below code to disable the request validation on the page which processes the upload request:
<%# Page Language="C#" ValidateRequest="false" %>
2)Assign permission:
The folder where you are going to save files should have modified permissions.
Assign the iis_iusrs and iusr or application pool identity full permission to the upload folder.
3)Configuring Maximum POST Request Length:
Usually, the limitation for maximum POST request length is specified to reduce the risk of DoS attacks. If the request size exceeds a specific value, it is considered malicious and the upload would be broken.
If you are going to upload files larger than the default limitation, increase the latter.
Go to C:\Windows\System32\inetsrv\config\applicationHost.config and change
<section name="requestFiltering" overrideModeDefault="Deny" />
To
<section name="requestFiltering" overrideModeDefault="Allow" />
add below code in your application web.config file:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength ="2147482624" /> <!-- in bytes -->
</requestFiltering>
</security>
</system.webServer>
<system.web>
<httpRuntime maxRequestLength="2097151"/> <!-- in kilobytes -->
</system.web>
4)Configuring Control to Support Medium Trust Level:
.NET Trust Level in IIS specifies the level of code access security for ASP.NET applications. By default, HTML5/Flash Uploader works under the full trust level. However, if you create a website with the medium trust level on your server, you should configure HTML5/Flash Uploader to support this level as well. To perform this, just set the MediumTrustCompatibility property to true as the snippet below shows:
<aur:ImageUploaderFlash ID="ImageUploaderFlash1" runat="server"
MediumTrustCompatibility="true">
</aur:ImageUploaderFlash>
Setting the MediumTrustCompatibility property to true requires an application's pool to be routed to a single worker process. To perform this run IIS Manager, choose the application pool under which your website works, click Advanced Settings in the Actions panel, and set Maximum Worker Processes to 1:
In my local machine the project works fine, i have the following options inside my web.config:
<httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" />
and
<security>
<requestFiltering allowDoubleEscaping="false">
<requestLimits maxQueryString="2097151" maxUrl="10999" />
</requestFiltering>
</security>
When i have it on my windows web server 2008 machine it works fine except for the pages with long query strings.
Local Machine Specs:
Windows 8
IIS 8.0
also tested in another Local Machine with the following Specs:
Windows 7
IIS 7.5
Server Specs:
Windows Web Server 2008
IIS 7.0
If any more info is required let me know and i will edit the question.
I've looked into other SO questions and i couldn't find an answer for this, any suggestions?
I know that this problem has a solution in stackoverflow, but it didn't work for me. I will be more specific below:
I had typical Maximum request length exceeded exception:
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds the request content length.
That's my changes to web.config, under system.web:
<httpRuntime maxRequestLength="200000" executionTimeout="300" />
and under system.webServer:
<security>
<requestFiltering allowDoubleEscaping="false">
<requestLimits maxAllowedContentLength="200000000" />
</requestFiltering>
</security>
I also made this changes in applicationHost.
On one machine these worked like charm. That was windows 7 + iis 7.5. But on another with windows server 2008 + iis 7.0 I cannot get upload of 19 MB to work. I really dont know what to do now. Please help anyone.
OK. That machine was client's machine. Apparently he changed something in IIS manager regarding one of the site's subfolders and IIS manager created web.config in subfolder that was overriding my setting in parent.
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.
I am using HttpContext.RewritePath in Global.asax for some URL rewriting, and it works very well in my development environment on the Cassini server. But when I copy it to the production server running IIS 7, it isn't working. I have also tried to use Context.Server.TransferRequest but then I get the error: "This operation requires IIS integrated pipeline mode." on both Cassini and IIS 7 (on IIS 7 the website is running in "Integrated" mode in the AppPool).
I rewrite all URLs on the website like /[The main menuname]/[pagename].aspx e.g. from /web/thesite.aspx?mainmenu=manager to /manager/thesite.aspx OR /web/theOtherSite.aspx?mainmenu=about to /about/theOtherSite.aspx, and so on...
I found out that i need to add the following to web.config
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</system.webServer></configuration>