I get this error when I try to call the constructor HtmlParser inside my webMethod in a aspx page
Attempt by security transparent method 'AngleSharp.Browser.EncodingMetaHandler..ctor()' to access security critical method 'System.Text.Encoding.RegisterProvider(System.Text.EncodingProvider)' failed. Assembly 'AngleSharp, Version=0.14.0.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself. In order to access security critical code, this assembly must be fully trusted.
When I run the webmethod on local IIS no problem, when I run on server where my website is relaeased I get the error above.
Server is in share hosting ( Microsoft Windows Server 2012 R2 Standard). Trust Level is set to MEDIUM.
It's not possible to change server configuration.
What I've tried is:
- Sign all my generated libraries
- rebuild AngleSharp.dll adding attribute AllowPartiallyTrustedCallers to the assembly
Can someone give me a suggestion?