467,179 Members | 1,238 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,179 developers. It's quick & easy.

Error calling _AppDomain->CreateInstanceFrom method

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 ?



Nov 16 '05 #1
  • viewed: 2122
1 Reply

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

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

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" <dp****@bankofny.com>
!Sender: "dwp" <dp****@bankofny.com>
!Subject: Error calling _AppDomain->CreateInstanceFrom method
!Date: Fri, 19 Sep 2003 01:49:20 -0700
!Lines: 14
!Message-ID: <0f****************************@phx.gbl>
!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
!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 ?

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Gilles A. | last post: by
2 posts views Thread by bradleyp@inspection.gc.ca | last post: by
reply views Thread by Jeremy Cowles | last post: by
4 posts views Thread by gizz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.