<p>What kind of multi-threading issues do you have to be careful for in asp.net?  </p>

[{'answer_id': 50226, 'author': 'Gulzar Nazim', 'author_id': 4337, 'author_profile': 'https://Stackoverflow.com/users/4337', 'pm_score': 0, 'selected': False, 'text': '<p>Programmatic Caching is one area which immediately comes to my mind. It is a great feature which needs to be used carefully. Since it is shared across requests, you have to put locks around it before updating it.</p>\n\n<p>Another place I would check is any code accessing filesystem like writing to log files. If one request has a read-write lock on a file, other concurrent requests will error out if not handled properly.</p>\n'}, {'answer_id': 50232, 'author': 'kemiller2002', 'author_id': 1942, 'author_profile': 'https://Stackoverflow.com/users/1942', 'pm_score': 3, 'selected': False, 'text': '<p>One thing to watch out for at things that expire (I think httpContext does), if you are using it for operations that are "fire and forget" remember that all of a sudden if the asp.net cleanup code runs before your operation is done, you won\'t be able to access certain information.  </p>\n'}, {'answer_id': 50292, 'author': 'Jason Baker', 'author_id': 2147, 'author_profile': 'https://Stackoverflow.com/users/2147', 'pm_score': 2, 'selected': False, 'text': '<p>If this is for a web service, you should definitely consider thread pooling.  Too many threads will bring your application to a grinding halt because they will eventually start competing for CPU time.  </p>\n\n<p>Is this for file or network IO?  If so, you should also consider using <a href="http://msdn.microsoft.com/en-us/magazine/cc700359.aspx?pr=blog" rel="nofollow noreferrer">asynchronous IO</a>.  It can be a bit more of a pain to program, but you don\'t have to worry about spawning off too many threads at once.</p>\n'}, {'answer_id': 50377, 'author': 'Eric Z Beard', 'author_id': 1219, 'author_profile': 'https://Stackoverflow.com/users/1219', 'pm_score': 3, 'selected': False, 'text': "<p>It's risky to spawn threads from the code-behind of an ASP.NET page, because the worker process will get recycled occasionally and your thread will die.</p>\n\n<p>If you need to kick off long-running processes as a result of user actions on web pages, your best bet is to drop a message off in MSMQ and have a separate background service monitoring the queue.  The service could take as long as it wants to accomplish the task, and the web page would be finished with its work almost immediately.  You could accomplish the same thing with an asynch call to a web method, but don't rely on getting the response when the web method is finished working.  From code-behind, it needs to be a quick fire-and-forget.</p>\n"}, {'answer_id': 50387, 'author': 'Michael Stum', 'author_id': 91, 'author_profile': 'https://Stackoverflow.com/users/91', 'pm_score': 0, 'selected': False, 'text': "<p>Isn't there a Limit of 25 Total Threads in the IIS Configuration? At least in IIS 6 i believe. If you exceed that limit, interesting things (read: loooooooong response times) may happen.</p>\n"}, {'answer_id': 27557071, 'author': 'Brian Mains', 'author_id': 231716, 'author_profile': 'https://Stackoverflow.com/users/231716', 'pm_score': 0, 'selected': False, 'text': "<p>Depending on what you need, as far as multi threading is concerned, have you thought of spawning requests from the client.  It's safe to spawn requests using AJAX, and then act on the results in a callback.  Or use a service as a backgrounding mechanism, which runs every X minutes and processes in the background that way.</p>\n"}]
['https://Stackoverflow.com/questions/50221', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1642688/']