Re: Appdomain.CreateDomain throws SecurityException

From: Nicole Calinoiu (calinoiu)
Date: 06/14/05


Date: Tue, 14 Jun 2005 07:17:44 -0400

What is the code for the version of SPInsertTest that generates this
exception?

"Praisy" <Praisy@discussions.microsoft.com> wrote in message
news:F83105AF-E82B-481B-A231-5E1948545CCF@microsoft.com...
> Hi!
> Thanks for the info. While creating the assembly in SQLServer 2005, I had
> set the PERMISSION_SET to EXTERNAL_ACCESS during which I got the security
> Exception. Now I changed to UNSAFE and got the TypeLoadException as
> follows.
>
> System.TypeLoadException: The domain manager specified by the host could
> not
> be instantiated.
> at System.AppDomain.nCreateDomain(String friendlyName, AppDomainSetup
> setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo,
> IntPtr
> parentSecurityDescriptor)
> at System.AppDomainManager.CreateDomainHelper(String friendlyName,
> Evidence securityInfo, AppDomainSetup appDomainInfo)
> at System.AppDomainManager.CreateDomain(String friendlyName, Evidence
> securityInfo, AppDomainSetup appDomainInfo)
> at System.AppDomain.CreateDomain(String friendlyName, Evidence
> securityInfo, AppDomainSetup info)
> at StoredProcedures.SPInsertTest()
>
> Any idea what can be the reason??
> Thanks,
>
>
> "Nicole Calinoiu" wrote:
>
>> SQL Server 2005 imposes additional permission restrictions on managed
>> code
>> that it hosts. For an introduction to this topic, take a look at the
>> "CLR
>> Integration Security" topic in the BOL.
>>
>>
>> "Praisy" <Praisy@discussions.microsoft.com> wrote in message
>> news:42EA4E5E-0B83-4EF3-9E0C-A74CA51A1BB0@microsoft.com...
>> > Hi,
>> > The following exception occured when I tried to create an appdomain.
>> > "System.Security.SecurityException: Request for the permission of type
>> > 'System.Security.Permissions.SecurityPermission, mscorlib,
>> > Version=2.0.0.0,
>> > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
>> > at System.AppDomain.CreateDomain(String friendlyName, Evidence
>> > securityInfo, AppDomainSetup info)
>> > at StoredProcedures.SPInsertTest()
>> > The action that failed was:
>> > Demand
>> > The type of the first permission that failed was:
>> > System.Security.Permissions.SecurityPermission
>> > The Zone of the assembly that failed was:
>> > MyComputer "
>> >
>> > Let me explain what I have done.
>> >
>> > 1.I've created a class library by name TestApp which has a config file.
>> > I
>> > have method called Readconfig which reads from the config and puts the
>> > value
>> > in the file in some location. the readconfig method is called in the
>> > constructor of this class.
>> >
>> > 2. I've created an exe which refers the above calss libray and creates
>> > the
>> > object of the class present in it.
>> >
>> > 3. I've created a Managed stored procedure using the SQLServerProject
>> > in
>> > the
>> > whidbey. The stored procedure has the following code.
>> >
>> >
>> > AppDomainSetup ads = new AppDomainSetup();
>> > ads.ApplicationBase = @"C:\SPTestExe";
>> > ads.ConfigurationFile =
>> > @"C:\SPTestExe\TestAppExe.exe.config";
>> >
>> > //AppDomain ad = AppDomain.CreateDomain("TestApp", null,
>> > ads);
>> > AppDomain ad = AppDomain.CurrentDomain;
>> > ad.ExecuteAssembly(@"c:\SPTestExe\TestAppExe.exe");
>> >
>> > when I install this stored procedure in yukon and run it, I get the
>> > above
>> > mentioned exception.
>> >
>> > Not able to trace out the reason. Can anyone tel me what the problem
>> > is??
>> >
>> > Thanks,
>>
>>
>>



Relevant Pages

  • Re: Appdomain.CreateDomain throws SecurityException
    ... Follwoing is the code that generates this exception ... >> setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, ... >> Evidence securityInfo, AppDomainSetup appDomainInfo) ...
    (microsoft.public.dotnet.security)
  • Re: Appdomain.CreateDomain throws SecurityException
    ... setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr ... Evidence securityInfo, AppDomainSetup appDomainInfo) ... >> The following exception occured when I tried to create an appdomain. ...
    (microsoft.public.dotnet.security)
  • Re: Loading assemblies from another AppDomain
    ... Private bin path can't lie outside the ... > // Set up the AppDomainSetup ... > // Set up the Evidence ...
    (microsoft.public.dotnet.framework.clr)
  • RE: Loading assemblies from another AppDomain
    ... > assembly that is installed in the original (creator) domain. ... Have you checked the PrivateBinPath / PrivateBinPathProbe Properties from ... // Set up the AppDomainSetup ... Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; ...
    (microsoft.public.dotnet.framework.clr)

Quantcast