how to best manage processor from ASP.NET app on shared hosting
i am reading an RSS feed from a third party and then 开发者_如何学Goimport data into a database.
Occasionally this process times out.
{"Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."}
At the moment i have the following
1) A button on asp.net page 2) Downloads the rss 3) Queried using linq to get the data i want 4) Inserted into database.
What are good practise to minimise time outs. I was think calling an ashx on button click might help. Really appreciate suggestions. This will be on shared hosting.
thanks
It is your database insert that times out. This could happen if you have many connections to the same server. Are you sure you are closing your connections when you are done with them?
You can also try to increase the connection pool size. Please read this article: http://www.15seconds.com/Issue/040830.htm
It would be better if you could make the RSS call and DB insert from a new background thread. Use a regular page or .ashx or whatever to queue a request to the background thread.
If you keep it in a foreground thread, use async I/O whenever possible to avoid draining the ASP.NET worker thread pool.
And, of course, be sure to close/release/Dispose your all IDisposable objects.
精彩评论