views:

652

answers:

3

Hello,

This question is about App domains and Sessions. Is it possible to have IIS run each User Session in a seperate App Domain. If Yes, Could you please let me settings in the config file that affect this.

Regards, Anil.

A: 

I don't know of a way in which this could be easily done. Please explain your problem further as to why an AppDomain is necessary - it may be easier to just move Application collection use to Session.

Update: The correct solution to your problem is, unfortunately, to re-architect the library for a server-based session solution. What you could do, and I strongly do not recommend this, is create an AppDomain per Session, storing a reference to it in Session, and then relying on calls such as CreateInstanceAndUnwrap, magic strings, and reflection (with no real compile time checking) to load an instance of the library per user. I imagine that if you pursue this solution you will spend much more time in total debugging it and dealing with errors than you would if you did a re-architecture time investment upfront.

cfeduke
The reason that we wanted it was because we have a library that we have for windows app and we want to use the same thing for the web app and the client library has caching and other features. When we try to use it we got into problems. So to get around that we thought of using the above.
A: 

This is not possible under Windows 2000 or Windows 2003 running ASP.NET 1.x or ASP.NET 2.0 (even with .NET Framework 3.5 installed). The same applies to ASP.NET running on IIS7.

Kev
A: 

A possible workaround (which certainly wouldn't scale) would be to create a windows service to manage the starting and stopping of new processes and communicate with that service from the web application using WCF.

duckworth