Request for the permission of type 'System.Web.AspNetHostingPermission' failed when compiling web site on a Network Share or Intranet Project

后端 未结 3 1635
心在旅途
心在旅途 2021-02-14 07:20

I have been using Windows 7 for a while but have not had to work with a particular legacy intranet application since my upgrade. Unfortunately, this application is setup as an A

3条回答
  •  深忆病人
    2021-02-14 08:12

    After some additional digging I came across a blog post by Aaron Stebner covering Details about setup for the .NET Framework 2.0 configuration tool. Stebner details how the Configuration Utility was removed from the .NET redistributable and placed only in the SDK. Not a big deal a few years ago but now that the community relies upon newer SDKs and only installs the redistributable / compact versions of the framework we have lost access to the .NET Framework 2.0 Configuration Tool.

    The official answer from Microsoft is to Configure Security Policy Using the Code Access Security Policy Tool (Caspol.exe). Unfortunately, this command line utility did not work for me. I however, do not rule out user error as to why it failed.

    Ultimately, Stebner solved my issue because he provides an installer for the configuration tool. Which once I had the configuration utility installed allowed me follow the steps outlined in th DotNetSlackers article System.Web.AspNetHostingPermission when Accessing Network or Intranet Projects using Visual Studio 2005 which I have paraphrased into steps below.

    To change the local machine's .NET Security Settings goto

    Start > Control Panel > Administrative Tools > Microsoft .NET Framework 2.0 Configuration

    Fully expand My Computer and select Runtime Security Policy. On the right, choose Adjust Zone Security. Leave the default option (Make changes to this computer) and hit next. Choose Local Intranet and change the trust level to Full Trust. Then choose Next and then Finish. Restart Visual Studio and you should be all set.

提交回复
热议问题