Article ID: 813830 - Last Review: April 19, 2007 - Revision: 1.9 PRB: Appdomains Security Permission Error Message When You Access the Strong-Named Assembly from the \Bin DirectoryOn This PageSYMPTOMSIn a Microsoft ASP.NET version 1.1 application, when you
access a strong-named assembly that is stored in the \bin directory of your Web
application that is not marked with AllowPartiallyTrustedCallersAttribute (APTCA) and when the trust level of the Web application is not
set to Full Trust in the Web.config file, then you may receive the following error
message instead of the expected SecurityException error message: Assembly <assembly>.dll security
permission grant set is incompatible between appdomains CAUSEStrong-named assemblies must be stored in the global
assembly cache when they are used with ASP.NET Web applications. By default,
strong-named assemblies will not grant access to partially trusted code,
because of the visibility of strong-named assemblies in the global assembly
cache. You can allow partially trusted code to call your strong-named assembly,
but only after you explicitly set the AllowPartiallyTrustedCallersAttribute. If you do not explicitly declare the attribute, the caller
requires Full Trust to use the code. Only apply the AllowPartiallyTrustedCallersAttribute to your strong-named assemblies after a careful assessment of the
code. RESOLUTIONInstall strong-named assemblies in the global assembly cache
for ASP.NET 1.0 and 1.1 Web applications. The following steps describe how to
install a strong-named assembly in the global assembly cache, and explain how
to use the AllowPartiallyTrustedCallersAttribute: Install a Strong-Named Assembly in the Global Assembly CacheYou can use the global assembly cache to share assemblies across many applications. To install the strong-named assembly in the global assembly cache, follow these steps:
Add the APTCAAssemblies that are intended to be called by partially trusted code declare their intent by the assembly-level custom attribute AllowPartiallyTrustedCallers. To mark the strong-named assembly with APTCA, follow these steps:
STATUS This
behavior is by design. MORE INFORMATIONSteps to Reproduce the BehaviorCreate a StrongName Assembly
Refer to the Assembly in an ASP.NET Web Application
REFERENCESFor more information, visit the following Microsoft Web
sites: ASP.NET Code Access Security http://msdn2.microsoft.com/en-us/library/87x8e4d1.aspx (http://msdn2.microsoft.com/en-us/library/87x8e4d1.aspx) MSDN Magazine “Security Briefs” (Hashing Passwords, The AllowPartiallyTrustedCallers Attribute) http://msdn2.microsoft.com/en-us/magazine/cc164107.aspx (http://msdn2.microsoft.com/en-us/magazine/cc164107.aspx) Application Domains and Assemblies http://msdn2.microsoft.com/en-us/library/43wc4hhs(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/43wc4hhs(vs.71).aspx) Strong Name Tool (Sn.exe) http://msdn2.microsoft.com/en-us/library/k5b5tt23(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/k5b5tt23(vs.71).aspx) Version 1 Security Changes for the Microsoft .NET Framework http://msdn2.microsoft.com/en-us/library/ms994923.aspx (http://msdn2.microsoft.com/en-us/library/ms994923.aspx) Global Assembly Cache Tool (Gacutil.exe) http://msdn2.microsoft.com/en-us/library/ex0ss12c(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/ex0ss12c(vs.71).aspx) For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base: 315682
(http://support.microsoft.com/kb/315682/EN-US/
)
HOW
TO: Install an Assembly into the Global Assembly Cache in Visual Studio
.NET
324519
(http://support.microsoft.com/kb/324519/EN-US/
)
PRB: "Can not Access File 'AssemblyName' Because It Is Being Used by Another Process" Error Message in ASP.NET
| Article Translations
|

Back to the top
