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

后端 未结 3 1634
心在旅途
心在旅途 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:11

    Try to change the application pool setting Load User Profile to True.

    In Windows 7 it is set to False by default. It seems that in Windows Vista IIS 7 sets this automatically for you.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-14 08:18

    this problem happens to me and the solution was easy, I just add permission fro the application pool user on the physical files, then make IISReset, and it's working now.

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