Setting aspNetCompatibilityEnabled to true throws MethodAccessException in REST-based WCF JSON service

In my web.config application. On, some servers if I set aspNetCompatibilityEnabled = true

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

I get a "MethodAccessException". I need to use aspNetCompatibilityEnabled. Since, I want this call to be authenticated by one of our HttpModule. I searched every time I did not find an answer. There seems to be an IIS installation that can fix it. Because it works in some internal environments.

+3
source share
2 answers

You tried to put:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 

over class declaration of service?

+2
source

If you have multiple WCFS services, than adding this to all services

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
+2

Source: https://habr.com/ru/post/1783969/


All Articles