AppDomain
-
I try to log what's going on in my web application in separate logfiles named by the session ID. The logging is done by a common object which is defined in a dll referenced by the web application. The problem is that when there are two (or more) paralell sessions running they will have different log files but log will be written in the log file created later. That is because these sessions run in the same AppDomain that's why logging object is the same and it's LogPath is allways set by the session launched later. Is it possible to set up the system (IIS for example) to run different sessions in different AppDomains?
-
I try to log what's going on in my web application in separate logfiles named by the session ID. The logging is done by a common object which is defined in a dll referenced by the web application. The problem is that when there are two (or more) paralell sessions running they will have different log files but log will be written in the log file created later. That is because these sessions run in the same AppDomain that's why logging object is the same and it's LogPath is allways set by the session launched later. Is it possible to set up the system (IIS for example) to run different sessions in different AppDomains?
You can set up seperate AppDomains per asp.net application, but not per session. For a log file it is probably best to have one log file and make the sessionID a column in the log so that you can seperate the session data out when you read. That will generally perform the best. If you really need one log file per session then you can create a log on the Session start event and store the log in the session object. Of add a branch in your logging object to write out to seperate files, but that will be a bottleneck as the number of users increases. I may be working, but I'm not working for you. - Superchunk