0

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?

Alberto
  • 11
  • 3
  • Does this answer your question? [Assembly does not allow partially trusted caller](https://stackoverflow.com/questions/3487001/assembly-does-not-allow-partially-trusted-caller) – Liam Apr 08 '21 at 08:01
  • There are multiple causes to this issue the underlying cause will depend on what technology your using, server deployment, etc. etc – Liam Apr 08 '21 at 08:03
  • Framework is 4.6.1 – Alberto Apr 08 '21 at 15:45
  • 1
    Server is Microsoft Windows Server 2012 R2 Standard Being a shared server, I have no possibility to apply any configuration change. – Alberto Apr 08 '21 at 16:20
  • 1
    I add some other details. The Web Site runs on a shared hosting (ARUBA) where the trust level is set to "medium". In additon I got the same error with Paypal SDK. I suppose that the only solution is to request to my host to move from MEDIUM to FULL – Alberto Apr 08 '21 at 19:08

0 Answers0