How to request a permission of type System.Net.WebPermission in ASP.NET MVC?

后端 未结 3 1255
我寻月下人不归
我寻月下人不归 2021-01-18 23:22

I created a small web service that creates a HttpWebRequest to another website using a proxy and after i used the proxies i got that error:

相关标签:
3条回答
  • 2021-01-18 23:29

    It seems that you are running into a trust related issue. You might be able to work-around the issue by including in your Web.Config, under System.Web,

    <trust level="Full" />
    

    WebPermission is not available under a medium trust environment (and you can look at this article to modify this behavior and for the reasons why you shouldn't).

    However, if you require full trust you might have to reconsider the requirements of your application.

    0 讨论(0)
  • 2021-01-18 23:40

    go to properties of your Project/application (WPF)

    In security select enable clickone securitysetting. and set trust level of the project

    0 讨论(0)
  • 2021-01-18 23:45

    I was also having this issue - and it turned out to be due to dll performing the web request having being downloaded from the web.

    I had to go into the Properties of the dll in file explorer (right click> Properties) and click "Unblock" - making sure to click "Apply" and then "Ok".

    0 讨论(0)
提交回复
热议问题