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

查看:145
本文介绍了在网络共享或Intranet项目编制网站时,请给类型“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安全配置信任级别更改为全为本地Intranet(<一href="http://dotnetslackers.com/Security/re-50692_System_Web_AspNetHostingPermission_when_Accessing_Network_or_Intranet_Projects_using_Visual_Studio_2005.aspx">fix这里所述)。我相信这个配置工具依赖从一些粗略的研究似乎是分开的.NET 2.0 SDK的的Mscorcfg.msc。我试图遵循这一微软支持文章的说明运行下面的命令,都无济于事。

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

presently,我有以下.NET,我的机器安装ASP.NET和.NET SDK组件

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

  • 在微软.NET Compact Framework的2.0 SP2
  • 在微软的.NET Compact Framework 3.5的
  • 的Microsoft .NET Framework 4客户端配置文件
  • 的Microsoft .NET Framework 4扩展
  • 的Microsoft .NET Framework 4的多目标包
  • 在微软ASP.NET MVC 1.0
  • 在微软ASP.NET MVC 2
  • 在微软ASP.NET MVC 2 - Visual Studio 2008的工具
  • 在微软ASP.NET MVC 2 - 的Visual Studio 2010工具
  • 在微软Windows SDK的Visual Studio 2008的.NET Framework工具 - ENU
  • 在微软Windows SDK的Visual Studio 2008的头文件和库
  • 在微软Windows SDK的Visual Studio 2008的SDK参考组件和智能感知
  • 在微软的Windows SDK的Visual Studio 2008 SP1工具
  • 在微软的Windows SDK的Visual Studio 2008 SP1的Win32工具
  • 在微软的Windows SDK的Windows Server 2008(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?

推荐答案

在其他一些挖我碰到由Aaron Stebner一篇博客文章中涉及的有关安装的.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.

这是微软官方的答案是配置安全策略使用code访问安全策略工具(的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解决了我的问题,因为他提供了一个<一个href="http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/configwizard.zip">installer对于配置工具。曾经我已经安装配置实用程序让我按照日<一所列的步骤href="http://dotnetslackers.com/Security/re-50692_System_Web_AspNetHostingPermission_when_Accessing_Network_or_Intranet_Projects_using_Visual_Studio_2005.aspx">DotNetSlackers访问网络或Intranet的项目时,使用Visual Studio 2005 我所转述到下面的步骤文章System.Web.AspNetHostingPermission。

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

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

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

完全展开的我的电脑的选择的运行安全策略的。在右边,选择的调整区域安全性的。保留默认选项(修改此计算机上),并点击下一步。选择的本地Intranet 的并更改信任级别的完全信任的。然后选择下一步,然后完成。重新启动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.

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

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