Share via


How to avoid server error 500

Question

Tuesday, July 3, 2007 3:51 PM

Hi, I have a page with database operation. If there is not so much data, sql query can be finished in a short time. The code works fine.

But if there is a lot of data, the page need to connect to database again and again need a lot of time, I'll get 500 error.

So I know there is no problem with the code. the problem is timeout issue. So I set all timeout as below:

sqlcommand.CommandTimeout: 1600 seconds
System.Web.UI.ScriptManager:sm.AsyncPostBackTimeout = 7200 seconds
Weh Server Session time: 240 minutes
ASP Script timeout: 900 seconds
 

But I still get 500 error even with 5 -10 minutes! why?

I want the page keep to wait for all the time until the operation is done.  How to implement it?

 

 

All replies (8)

Monday, July 9, 2007 4:09 AM ✅Answered

Hi, KentZhou

The following link give the answer:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/44ebc761-ac76-4b44-8894-551c9315af6c.mspx?mfr=true

Setting Connection Timeouts (IIS 6.0)

Connection time-outs help reduce the loss of processing resources consumed by idle connections. When you enable connection time-outs, IIS enforces the time-outs at the connection level.

  Important

You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type **runas /user:**Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".

Procedures

To set a global WWW or FTP service connection time-out value

1.

In IIS Manager, expand the local computer, right-click the Web Sites or FTP Sites folder, and click Properties.

2.

On the Web Site or FTP Site tab, in the Connection timeout box, type the maximum number of seconds that IIS should maintain an idle connection before resetting the connection.

3.

For the WWW service, verify that the Enable HTTP Keep-Alives box is selected. For more information, see Enabling HTTP Keep-Alives.

4.

Click Apply, and then click OK.

To set a connection time-out value for a specific Web or FTP site

1.

In IIS Manager, expand the local computer, expand the Web Sites or FTP Sites folder, right-click a Web or FTP site, and click Properties.

2.

On the Web Site or FTP Site tab, in the Connection timeout box, type the maximum number of seconds that IIS should maintain an idle connection before resetting the connection.

3.

For the WWW service, verify that the Enable HTTP Keep-Alives box is selected. For more information, see Enabling HTTP Keep-Alives.

4.

Click Apply, and then click OK.

For more information about connection timeouts, including which counters to use to monitor connection timeouts, see Setting Connection Timeouts to Save Resources.

For more information about improving the performance of IIS network resources using related features like bandwidth throttling, HTTP Compression, and connection limits, see Administering Network Resources.

For information about setting CGI application timeouts, see Configuring CGI Application Timeouts.

 


Tuesday, July 10, 2007 2:36 PM ✅Answered

 Finally, I find out the reason: there is a  Timer control whose setting conflicts with session setting.

Thank all of you guys for help. 


Tuesday, July 3, 2007 4:27 PM

5-10 mintues is far too long to wait for a web page to load. It should be a few seconds really. If you want to run something that takes a while, it should be run as a seperate process that allows you to check on it's status.
 


Wednesday, July 4, 2007 3:04 AM

Hi,

are you sending JSON data back to the browser?

If so, you may be hitting the maximum size allowed for JSON data. To change this, you should uncomment and change the following line in the web.config:

<jsonSerialization maxJsonLength="500" />


Wednesday, July 4, 2007 12:47 PM

 No, I did not use any webservice in my application. So all setting in <webServices> are commented out.


Wednesday, July 4, 2007 11:48 PM

Hi!,

That exception is a callback exception and the PageRequestManager is the AJAX ScriptManager control. 

You could customize the callback errors using the AsyncPostBackErrorMessage property of the ScriptManager.

Also, if you want to handle the error on server-side, use the ScriptManager_AsyncPostBackError event.

Please refer to this: http://support.microsoft.com/kb/193625

 

Check this article http://blog.g9th.com/2007/01/14/unable-to-validate-data-at-systemwebconfigurationmachinekeysectiongetdecodeddata.aspx

Let me know if you need more info.
You can also see this thread for more help: http://forums.asp.net/t/1115331.aspx


Friday, July 6, 2007 1:05 PM

 Hi I just moved the application to another IIS server. It works fine. I can wait until the operation is done.

Very confused. IIS on different machine have same setting. Database server is same. codes are same.

Why? 


Tuesday, July 10, 2007 11:35 PM

Hi Jin-Yu Yin thanks for providing link..[:)]