By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,530 Members | 2,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,530 IT Pros & Developers. It's quick & easy.

Error calling _AppDomain->CreateInstanceFrom method

P: n/a
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
Share this Question
Share on Google+
1 Reply

P: n/a

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! -
This posting is provided "AS IS" with no warranties, and confers no rights.

!Content-Class: urn:content-classes:message
!From: "dwp" <dp****>
!Sender: "dwp" <dp****>
!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==
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl
!NNTP-Posting-Host: TK2MSFTNGXA09
!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.