Hello,
Thanks for posting in the group.
Is the target assembly a strong named? Strong-naming an assembly has the
effect of adding a LinkDemand for "FullTrust" to every class. If you must
sign the target assembly then to workaround, you need to add
[assembly:AllowPartiallyTrustedCallers] to it.
Types in strong-named assemblies can be called by partially trusted code
only when the assemblies have been marked with the
AllowPartiallyTrustedCallers attribute (APTCA). This attribute essentially
removes the implicit LinkDemand for the FullTrust permission set that is
otherwise automatically placed on each publicly accessible method in each
type.
Note that doing this has security implications. Essentially, you're saying
that any partially-trusted assembly can call your target assembly, so it
could be repurposed by malicious code. One way to help this situation is to
add your own LinkDemand and InheritanceDemand to every class in your target
assembly. For example, you could LinkDemand+InheritanceDemand that the
caller is signed with your key.
For details, please refer to
http://msdn.microsoft.com/library/en-us/dnnetsec/html/seccodeguide.asp?frame
=true.
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
!Content-Class: urn:content-classes:message
!From: "dwp" <
[email protected]>
!Sender: "dwp" <
[email protected]>
!Subject: Error calling _AppDomain->CreateInstanceFrom method
!Date: Fri, 19 Sep 2003 01:49:20 -0700
!Lines: 14
!Message-ID: <
[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcN+iurqrrDyqvqwTqm6EWRbysxfqg==
!Newsgroups: microsoft.public.dotnet.languages.vc
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vc:28474
!NNTP-Posting-Host: TK2MSFTNGXA09 10.40.1.161
!X-Tomcat-NG: microsoft.public.dotnet.languages.vc
!
!hResult = pDefaultDomain->CreateInstanceFrom( pAppDomain-
!>m_bstrLoadAssemblyName, pAppDomain->m_bstrManagedClass,
!&pObjectHandle )
!
!This call gives the E_ACCESSDENIED return value. I have
!checked that nothing is using the loaded assembly and that
!the access rigts are OK.
!
!Does anyone know of another reason for this return value ?
!
!Thanks,
!
!dwp
!
!