ASP.NET Uploading file over 300KB~ makes browser lose connection - asp.net

I've been running my image-uploading site for about a month now. I haven't touched the script lately and this problem that occurs now never happened before, with even bigger uploads.
When uploading a file with a size that exceeds the 300 KB area, your browser would lose connection. Anything lower than that would upload immediatly, you hit the upload button in no moments you're redirected to the page of your image.
The website address is http://img.kfirprods.com/Upload.aspx
As for my web.config, I tried all these suggestions to change execution time and maxRequestLength but none of these helped, with both modest sizes and unmodest sizes. The default settings for the requestLength is about 4MB and the user-server connection is lost way before that. This is my web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime requestValidationMode="2.0" />
<customErrors mode="Off"/>
<machineKey
validationKey="EEF33150A048D162D22CB36E1CB9956B148C7A4E6999D0F05B53D416D7A16F83823DD626F501DD3549D3E5DCB473634739D0AD9A07F71560946498C943A7586D"
decryptionKey="0E95F75864047EB6322EA7D5246F2C1175D77A1B016F293C3BAAD000299A3DC8"
validation="SHA1"
decryption="AES" />
</system.web>
</configuration>
There were others httpRuntime settings but even the default settings, which should work - don't. However, what exactly happens is that the server behaves as if it's down but it will only be down to the user who exceeded that small size of upload and return after a minute or two. Please, anyone who's even a bit of an expert - try to upload some 'heavy' picture and see if you recognize the problem.

Put following in your web.config file
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" />
</system.web>
</configuration>
by default the value is 4096 = 4mb. However, on shared hosting individual hosts might configure a different value and it limits the size of file that you can upload.
Further, you can/cannot modify these settings depending on the permissions given by your host.

Please set Server.ScriptTimeout to longer value like
Server.ScriptTimeout=36000
with adding
<httpRuntime maxRequestLength="9999" />
setting in webconfig. Please let me know if this does not work

The uploading limit of ASP.NET FileUploader is 4MB. But you can increase the limit of length of uploaded file by adding the following code into your web.config:
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" />
</system.web>
</configuration>
It's also a good idea to ADD executiontimeout
<configuration>
<system.web>
<httpRuntime maxRequestLength="4096" executiontimeout="700" />
</system.web>
</configuration>

I will ask the host provider (HostGator) if they know anything about it, again (the first customer support guy didn't seem to know much at all). If it won't work, I might as well give up, it's not like there are not enough image uploading websites on the web. Thanks for those who tried to help!

Related

How to debug large file upload error on IIS website (using Joomla)

I have seen many questions asking the same thing, and this trick seemed to work for them, but not in my case.
I have been tasked with setting up a webpage on a company's server for training videos. I can't embed them from a site such as YouTube because they contain sensitive information.
The webpage has been set up using Joomla on Windows Server 2012. This is the first time I've ever experienced IIS since I only have experience with Apache.
The files I am trying to upload are just under 1GB. When I attempt to upload, I get Error Total size of upload exceeds the limit.
Here is what I have placed in the web.config file (since there isn't a php.ini file):
<configuration>
<system.web>
<!-- this is my edit -->
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />
</system.web>
<location path=".">
<system.webServer>
<security>
<requestFiltering>
<!-- this is my other edit -->
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
I go into CMD and enter "iisreset" to restart, and it still gives me the same error.
I also found forums where people were advising a change with maxRequestLength, so I also wrote this in the config file:
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="3600" />
</system.web>
Still no dice. The client is becoming very impatient since they still haven't received what they asked for. We originally tried to place the videos on their Wordpress site, but that didn't work either since it is on a shared hosting server.
I found this webpage that instructed me (at the bottom) to run a program on the server, but I don't know how to do that yet. I unzipped it and it opened in Visual Studio. No idea where to go from here. Any help would be appreciated.

RadAsyncUpload Maximum File Size

I have been asked to write an application that basically moves files from a source (USB, CD) to a centralized location. Initially this application will be for internal use only but in the future may be needed by remote users. The files I need to move can be in excess of 4-5Gb. It has been suggested I use the Telerik RadAsyncUpload component. Can anyone tell me if I am likely to run into problems trying to upload files of this size using this control?
To allow larger uploads the maxRexquestLength and executionTimeout needs to be added to your web.config:
<system.web>
<httpRuntime targetFramework="4.5" maxRequestLength="5242880" executionTimeout="10800" />
</system.web>
The trickiest part of having this work is that the execution timeout may exceed the upload time required. So set it higher based on your average users bandwidth. We monitor this by logging when the execution timeout occurs and adjusting as needed periodically. Since your app will be internally initially this probably won't be an issue at all if they are transferring over the LAN.
Further info on this is available in the Telerik documentation here.
There are 3 parts on setting the size of the file that could be uploaded through RadAsyncUpload:
1) Setting the file size in the telerik control
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="100000000" />
</requestFiltering>
</security>
2)Configures ASP.NET HTTP runtime settings, to allow the http Request message to be able to include your file. Here we need to set the maxRequestLength and executionTimeout accordingly.
<system.web><httpRuntime targetFramework="4.5" maxRequestLength="102400" executionTimeout="2147483647" /></system.web>
3)IIS server would generally allow only 30MB of file to be uploaded. To be able to upload larger files, we need to make some other settings in the web.config , to increase the request limits.
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="100000000" />
</requestFiltering>
</security>

I'm getting runtime error for asp.net application, is it timeout issue?

I'm getting this runtime error sometime when I try to use asp.net application.
I'm getting this error when my browser windows is open for long time and I does not work on this.. might be server time
Is it because of login timeout ?
I do not believe there is any way to tell from this error message what the problem is. As the error message states, the current settings prevent the actual error message from being displayed! You need to change the settings so you can actually see the error message, that will help you figure out what is causing it.
To do that, go into your web.config file and set (Note Off has capital O)
On IIS6:
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/> <---- Optional
</system.web>
</configuration>
On IIS7:
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true"/>
</system.web>
</configuration>
Edit - adding some more information:
Hi ashuthinks, I see you have accepted my answer already, but just wanted to add a few more lines. If everything in your code is fine, and the website runs perfectly, and you only get an error message on your screen if you leave it idle for 20 minutes or so, it is possible you are hitting the session timeout. I don't have any experience with this, but I have heard of it happening.
One of the things you can try is to change the session timeout in your web.config :
There seems to be a nice article about this here: http://www.simon.kaulius.com/page_timeout_in_asp_net.htm
It talks about modifying web.config, and making changes in IIS and global.asax to redirect the user to another page on timeout.
There alsoseems to be a thread dealing with a timeout issue on stackoverflow: Session timeout in ASP.NET

Increase ASP.NET page timeout

I have a long running method which can take a minute. On my local, it's OK, but on the server, I get a 504 response. I assume this means the page is timing out. Is it SessionState that I need to change in the web.config? I tried that but didn't help.
What's the property to increase page timeout?
Thank you.
This should solve your problem. In the web.config put
<location path="somefile.aspx">
<system.web>
<httpRuntime executionTimeout="180"/>
</system.web>
</location>
Here is the source
You can take advantage of the HttpRuntime settings. I believe in your case you would tweak the executionTimeout property (which by default I believe is 90 seconds).
Here's a full rundown on the HttpRuntime settings: HttpRuntime Element (ASP.Net Settings Schema)
<configuration>
<system.web>
<httpRuntime maxRequestLength="4000"
enable = "True"
requestLengthDiskThreshold="512"
useFullyQualifiedRedirectUrl="True"
executionTimeout="90"
versionHeader="1.1.4128"/>
</system.web>
</configuration>
No, it has nothing to do with Session. It has to do with the Request Timeout. One thing that might work is to have this on your Web.config:
<httpRuntime executionTimeout="600" /> <!-value is in secs-->

Posting data to a HttpHandler greater then ~29MB gives a 404 error

I am testing a HttpHandler that accepts XML. It works fine when a small amount of data is posted but if I post data larger then approx 29mb, I get a asp.net 404 Error.
I am posting to the handler from another handler in the same project and I have tried 2 methods -
1. HttpWebRequest with "POST"
2. WebClient with UploadFile() and UploadData()
I get the same 404 error when the posted data is above 28.6 MB.
I also tried putting a breakpoint right in the beginning of the receiving handler and debugging. It is never hit. Appears like the handler was never called. Works ok for smaller sized data.
I already have the following setting. What am I doing Wrong?
<httpRuntime maxRequestLength="1048576" />
EDIT: I have also tried posting to a different handler that doesnt not consume posted data, just to test, but the results are the same.
Environment: Win 7, IIS 7.5, .net 3.5, VS 2008
alt text http://img401.imageshack.us/img401/4099/errormr.png
I discovered that the problem is with IIS 7 and above. It requires the max request length to be set in a different place.
See the following links -
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_22943810.html
http://msdn.microsoft.com/en-us/library/ms689462%28VS.90%29.aspx
The default value is 30000000. which is 28.6mb. The correct way to set in web.config is -
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"></requestLimits>
</requestFiltering>
</security>
</system.webServer>
This config cleared the error I was getting. I wish the errors reported were more descriptive, at least on local machines
Does this mean that setting <httpRuntime maxRequestLength="1048576" /> is enough for IIS 6 ? (the live server is win2003)
Try to add this section to the web.config file:
<location path="YourHandler.aspx">
<system.web>
<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
</system.web>
</location>
assuming you handler path is YourHandler.aspx.

Resources