Create AppDomain in restricted security environment

100 views Asked by At

In .net4 the AppDomain.Create methods are marked with the SecuritySafeCritical attribute.

When these methods are invoked inside an environment with medium trust level a SecurityException is thrown (or am I wrong?)

How can I create another AppDomain from within an AppDomain with Medium Trust Level?

1

There are 1 answers

1
Roy Dictus On

Since, as you remark, these methods are marked SecuritySafeCritical, you can't.

You would need a "master" AppDomain that spawns child AppDomains, and that master has to have the top trust level.

But are you sure you need separate AppDomains, and since you are using ASP.NET, can you not just rely on IIS to make sure you get the independence and separation of logic/data/security you need?

If you intend to load and unload assemblies dynamically, you will indeed need to be able to create and destroy separate AppDomains, since there is no way to unload individual assemblies from an AppDomain. Otherwise, you may not even require this (expensive) feature.