System.MethodAccessException: Attempt to access the method failed


Hari Menon


I have an ASP.NET web application that connects to a web service (the web
app contains a DLL that connects to the web service). This works fine when I
deploy it on the Default Web Site on IIS.

However, if I deploy it on a SharePoint website, I get the
"System.MethodAccessException: Attempt to access the method failed." error -
the full call stack is shown below. From what I can see, SharePoint uses
impersonation. Is that the problem?

How do I solve this problem?


System.MethodAccessException: Attempt to access the method failed. at
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly,
Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean&
bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean
publicOnly, Boolean fillCache) at
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
skipVisibilityChecks, Boolean fillCache) at
System.Activator.CreateInstance(Type type, Boolean nonPublic) at
methodInfo) at
methodInfo, SoapReflectedExtension[] extensions) at
System.Web.Services.Protocols.SoapClientType..ctor(Type type) at
(call stack of my app)


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question