I posted a question yesterday about how to enable impersonation using WCF services here: WCF service not impersonating specified user in config?
I enabled aspnetCompatibilityMode but when I update my service proxy, it says "the service cannot be activated because it requires asp net compatibility". I'm not entirely sure what this means. If I change the setting to AspNetCompatibilityRequirementsMode.Allowed, it doesn't enable impersonation. I tried enabling the setting in both the web.config as well as via the class attribute.
Is there a way around this without setting my service's app pool to run as the user I need? Thanks.
You must turn on AspNetCompatibility in web.config of site hosting your service:
<system.serviceModel>
...
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
</system.serviceModel>
Because you are making your service implementation dependent on ASP.NET you should mark your service class with:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
Default value of AspNetCompatibilityRequirements.RequirementMode
is NotAllowed
so that is most probably reason for your exception.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With