在网络共享或内联网项目上编译网站时,请求“System.Web.AspNetHostingPermission”类型的许可失败 [英] Request for the permission of type 'System.Web.AspNetHostingPermission' failed when compiling web site on a Network Share or Intranet Project

查看:189
本文介绍了在网络共享或内联网项目上编译网站时,请求“System.Web.AspNetHostingPermission”类型的许可失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Windows 7一段时间,但从升级后就不用处理特定的旧版Intranet应用程序。不幸的是,这个应用程序被设置为一个内部网服务器上托管的ASP.NET网站项目。当我在Visual Studio 2008中打开网站并尝试调试它时,我收到以下编译器错误:

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 ASP.NET Website project hosted on an intranet server. When I have the website open in Visual Studio 2008 and try to debug it, I receive the following compiler error:

请求System类型的权限。 Web.AspNetHostingPermission'失败

为了在Windows Vista机器上解决此问题,我将本机的内部网络的机器的.NET安全配置信任级别更改为已满(在此处概述)。我相信这个配置实用程序依赖于mscorcfg.msc,这些一些粗略的研究似乎是.NET 2.0 SDK中的一部分。我试图按照以下 Microsoft支持文章中的说明执行以下命令,无法使用。

To resolve this issue on Windows Vista machines, I would change the machine's .NET Security Configuration trust level to full for the local intranet (fix outlined here). I believe this configuration utility relied upon the mscorcfg.msc which from some cursory research appears to be apart of the .NET 2.0 SDK. I have tried to follow the instructions from this Microsoft Support article running the command below to no avail.


Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url
"file:////\\computername\sharename\*" FullTrust -exclusive on

目前,我在我的机器上安装了以下.NET,ASP.NET和.NET SDK组件

Presently, I have the following .NET, ASP.NET, and .NET SDK components installed on my machine


  • Microsoft .NET Compact Framework 2.0 SP2

  • Microsoft .NET Compact Framework 3.5

  • Microsoft .NET Framework 4客户端配置文件

  • Microsoft。 .NET Framework 4扩展

  • Microsoft .NET Framework 4多目标包

  • Microsoft ASP.NET MVC 1.0

  • Microsoft ASP.NET MVC 2

  • Microsoft ASP.NET MVC 2 - Visual Studio 2008工具

  • Microsoft ASP.NET MVC 2 - Visual Studio 2010工具

  • Microsoft Windows SDK for Visual Studio 2008 .NET Framework工具 - enu

  • Microsoft Windows SDK for Visual Studio 2008标题和库

  • Microsoft Windows SDK for Visual Studio 2008 SDK参考汇编和智能感知

  • 适用于Visual Studio 2008 SP1工具的Microsoft Windows SDK

  • Microsoft Windows SDK for Visual Studio 2008 SP1 Win32工具

  • 适用于Windows Server 2008的Microsoft Windows SDK(6001.18000.367)

  • Microsoft .NET Compact Framework 2.0 SP2
  • Microsoft .NET Compact Framework 3.5
  • Microsoft .NET Framework 4 Client Profile
  • Microsoft .NET Framework 4 Extended
  • Microsoft .NET Framework 4 Multi-Targeting Pack
  • Microsoft ASP.NET MVC 1.0
  • Microsoft ASP.NET MVC 2
  • Microsoft ASP.NET MVC 2 - Visual Studio 2008 Tools
  • Microsoft ASP.NET MVC 2 - Visual Studio 2010 Tools
  • Microsoft Windows SDK for Visual Studio 2008 .NET Framework Tools - enu
  • Microsoft Windows SDK for Visual Studio 2008 Headers and Libraries
  • Microsoft Windows SDK for Visual Studio 2008 SDK Reference Assemblies and IntelliSense
  • Microsoft Windows SDK for Visual Studio 2008 SP1 Tools
  • Microsoft Windows SDK for Visual Studio 2008 SP1 Win32 Tools
  • Microsoft Windows SDK for Windows Server 2008 (6001.18000.367)

我需要安装.NET 2.0 SDK吗?我是否正确地发行 caspol 命令?还有其他的东西,我错过了吗?

Do I need to install the .NET 2.0 SDK? Am I issuing the caspol command incorrectly? Is there something else that I am missing?

推荐答案

经过一些额外的挖掘,我遇到了一篇博客文章, href =http://blogs.msdn.com/astebner/archive/2006/01/23/516671.aspx =noreferrer>有关.NET Framework 2.0配置工具设置的详细信息。 Stebner详细介绍了配置实用程序如何从.NET可重新发行版中删除并仅放置在SDK中。几年前不是很大的事情,但现在社区依赖于较新的SDK,只安装了我们无法访问.NET Framework 2.0配置工具的框架的可重新分发/紧凑版本。

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.

Microsoft的官方答复是使用代码配置安全策略访问安全策略工具(Caspol.exe)。不幸的是,这个命令行实用程序对我来说没有效果。然而,我不排除用户错误,为什么它失败。

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.

最终,Stebner解决了我的问题,因为他提供了一个安装程序的配置工具。一旦我安装了配置实用程序,我可以按照 DotNetSlackers文章System.Web.AspNetHostingPermission中列出的步骤当我使用Visual Studio 2005访问网络或Intranet项目时,我已经释放了以下步骤。

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.

要更改本地机器的.NET安全设置,请转到

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

开始>控制面板>管理工具> Microsoft .NET Framework 2.0配置

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

完全展开我的电脑并选择运行时安全策略。在右侧,选择调整区域安全性。保留默认选项(对此计算机进行更改),然后点击下一步。选择本地Intranet ,并将信任级别更改为完全信任。然后选择Next,然后选择Finish。重新启动Visual Studio,您应该全部设置。

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.

这篇关于在网络共享或内联网项目上编译网站时,请求“System.Web.AspNetHostingPermission”类型的许可失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆