Questions tagged [appdomainsetup]

AppDomainSetup provides configuration information for a new application domain which is an isolated environment in which Microsoft .NET assemblies can be sandboxed, granted specific permissions or PermissionSets and executed.

Definition:

An AppDomainSetup represents configuration information for a new application domain in which compiled Microsoft .NET assemblies can be isolated from other assemblies. While AppDomains are typically used to sandbox third-party or otherwise untrusted code, they can also be used to separate code from the main process to prevent potential instability in a specific segment of an application.

When creating your application domains, the most important property is ApplicationBase which defines the root directory of the application and also used for probing for the types and assemblies in the directory specified by the ApplicationBase property.

Tag Usage:

The appdomainsetup tag should be used when referencing issues related to the System.AppDomainSetup class in Microsoft .NET or related remoting or process issues.

Example (C#):

namespace AppDomainSetupExample
{
    using System;
    using System.IO;
    using System.Reflection;
    using System.Security;
    using System.Security.Permissions;
    using System.Security.Policy;

    class Program
    {
        static void Main(string[] args)
        {
            PermissionSet ps = new PermissionSet(PermissionState.None);
            ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
            ps.AddPermission(new FileIOPermission(FileIOPermissionAccess.Write, @"C:\"));

            var assembly = Assembly.GetExecutingAssembly();

            AppDomainSetup ads = new AppDomainSetup();
            ads.ApplicationBase = Path.GetFullPath(assembly.Location);
            StrongName fullTrustAssemblies = assembly.Evidence.GetHostEvidence<StrongName>();

            AppDomain domain = AppDomain.CreateDomain("foo", null, ads, ps, fullTrustAssemblies);

        }
    }
}
47 questions
2
votes
1 answer

Looking for minimum permissions to load assembly in Sandbox AppDomain. Why these permissions are needed?

I'm trying to put in place the minimum permissions for a sandbox AppDomain in order to load an assembly. It seems that it is mandatory to have PathDiscovery permission on the appBase and Read permission on the loaded assembly, but no permission is…
nakhli
  • 4,009
  • 5
  • 38
  • 61
2
votes
0 answers

Why does CreateInstanceFromAndUnwrap not work in a web container?

Hi I have code that looks like the following: public static I Load(string appDomainName, string fqDllName, string classType) where I : class { AppDomainSetup appDomainSetup = new AppDomainSetup(); AppDomain appDomain =…
Johan
  • 1,189
  • 3
  • 15
  • 28
2
votes
0 answers

Assembly.Load + AppDomain.CreateDomain

I'm loading new assembly (CLRHostHelper.dll) using Assembly.Load( byte[] ) method. From that assembly I'm calling AppDomain.CreateDomain - method throws exception: Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll Additional…
TarmoPikaro
  • 4,723
  • 2
  • 50
  • 62
2
votes
0 answers

How to use AppDomainInitializer in Powershell

I am trying to create an AppDomain in a Powershell script. I implemented the exact same in C# and it seems to be working fine. However, the Powershell version always fails with an exception. The script code is: function Execute($arguments) { …
mron
  • 95
  • 1
  • 8
2
votes
1 answer

Custom serialization across AppDomain

Short version: I'm trying to customize serialization across an AppDomain boundry, specifically to handle cases where each side of the AppDomain has a slightly different version of the class. How do I do this? Long version: We're using AppDomains to…
2
votes
1 answer

GAE - Domain Verification producing error

I have been adding domains to apps without any issues for past couple months, following these instructions https://developers.google.com/appengine/articles/domains Since past two days I have not been able to, when clicking Activate this service I…
1
vote
1 answer

How to use same custom domain for Web app hosted on Azure and web application hosted on window's IIS server?

I have a application which is hosted in IIS on window server and application URL is "www.hire.com/jobborad". Now i am going to add new feature(sub application) for example "Candidate Hub" so I am planning to created separate code-base and host that…
1
vote
1 answer

Passing log4net ConfigurationFile to a new AppDomain

What I need to do is get hold of the the : value but when I try to access the appender using the following :- var rootAppender = ((Hierarchy)LogManager.GetRepository()) …
Parsley
  • 41
  • 1
  • 5
1
vote
1 answer

Add path to Current AppDomain

I have two completely different directories. Directory 1 contains my application and Directory 2 having few assemblies. During run-time when application launches, I will load the assemblies. By default, the executing Assembly's AppDomain will…
Mani
  • 11
  • 2
1
vote
1 answer

C# Winforms - Trying to display OpenFileDialog by adding FileDialogPermission to AppDomainSetup

I'm trying understand Sandboxing in .Net4.0 but stumbled over this problem and unsure how to get around it within a C# Windows Form application. Within solution explorer I have 2 projects. The first project simply contains a Winform with a single…
maf
  • 25
  • 8
1
vote
2 answers

Get the control of AppDomain.CurrentDomain object in application

I need to set the current AppDomain to what I create. I want to Log my application exception using Enterprise Library HandleException method. When I handle the exception, it will insert a log into a logging table, and sets the AppDomainName field…
Pouyan
  • 2,849
  • 8
  • 33
  • 39
1
vote
1 answer

AppDomainSetup usage in ASP.NET

Since SetShadowCopyPath and SetShadowCopyFiles became obsolete since .NET 2.0, I want to set up these params via ShadowCopyDirectories and ShadowCopyFiles properties from AppDomainSetup class. In MSDN stands that this is the proper…
Ivan Peric
  • 4,263
  • 3
  • 23
  • 32
0
votes
0 answers

Can I create a new AppDomain without remoting call context?

We have some code that creates a new appdomain to perform a untrusted calculation. We are hitting a serialization exception creating the new appdomain because of some data that is stored in: System.Runtime.Remoting.Messaging.CallContext We were able…
Derek
  • 7,615
  • 5
  • 33
  • 58
0
votes
0 answers

Is there a .NET 7 alternative for creating AppDomain with LoaderOptimization?

Allow me to recount my experience with .NET Framework 4.8's AppDomains. I am presently working on an application that is graphically intensive, requiring approximately 20 seconds to load, with most of the time spent generating the user interface. To…
IneedHelp
  • 1,630
  • 1
  • 27
  • 58
0
votes
1 answer

HTTPS configuration in JFrog artifactory

I am using JFrog 7.17.x Artifactory version. I am accessing the JFrog console with http://localhost:8082. I have a domain configured for my environment (dev.sample.com). I would like to configure HTTPS and Domain setup for my JFrog Artifactory node…