System.Security.SecurityException: System.Web.AspNetHostingPermission

今天部署一个网站,在net 4.0下面正常,但是在2.0下面发现有错误:System.Security.SecurityException,错误信息如下所示:

安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。

异常详细信息: System.Security.SecurityException: 请求“System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败。

源错误:

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。

刚开始以为是权限问题,分别给C:\WINDOWS\temp 和C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files 授予NETWORK SERVICE、ASPNET 修改权限,无果,还是同样的错误。

最后如下方法解决:

在Web.config配置如下:

<authorization>
        <allow users="*" /> 
    </authorization>
    <identity impersonate="true" userName="nuc" password="" />
    userName="nuc" password=""是操作系统的登录名称和密码

System.Security.SecurityException: System.Web.AspNetHostingPermission

时间: 2024-08-24 10:46:42

System.Security.SecurityException: System.Web.AspNetHostingPermission的相关文章

System.Security.SecurityException The source was not found, but some or all event logs could not be searched.Inaccessible logs Security.

An exception occurred during the Install phase. System.Security.SecurityException The source was not found, but some or all event logs could not be searched.Inaccessible logs Security. 解决方法:使用管理员权限再次运行程序即可.

System.Security.SecurityException The type initializer for &#39;System.Data.Entity.Internal.AppConfig&#39; threw an exception

[15/08/19 00:03:10] [DataManager-7292-ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'System.Data.Entity.Internal.AppConf

Windows服务安装异常:System.Security.SecurityException: 未找到源,但未能搜索某些或全部事件日志。不可 访问的日志: Security

原文地址:http://blog.csdn.net/joyhen/article/details/42262305 2种方法处理: 一.右键单击“以管理员身份运行”Visual Studio Command Prompt即可 二.以管理员身份运行vs,然后打开项目,再执行InstallService程序安装服务. 附:具体构建windows 服务,可以看看这篇文章:http://www.cnblogs.com/LoveJenny/archive/2013/03/05/2943691.html

C# Windows服务安装出现System.Security.SecurityException异常解决办法

我把注册windows服务所用的安装及启用服务命令写到了bat可执行文件(名称为install.bat)中,如下所示: %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe CableAnti.Service.exeNet Start CheckOnlineServicesc config CheckOnlineService start= auto 然后我在Windows Server 2008R2上双击此bat文件后,

System.Web.AspNetHostingPermission 类型的权限已失败

System.Security.SecurityException: 请求“System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败 当你遇到这个问题的时候, IIS 找到网站对应的程序池 -> 高级设置 ->  加载用户配置文件 -> 选True -> 保存

无法将类型为“System.Security.Principal.GenericIdentity”的对象强制转换为类型“System.Web.Security.FormsIdentity”。

这次的系统包含两个子系统,所以做了一个分角色的身份验证系统. web.config <system.web>中设置 <authentication mode="Forms"> <!--验证方式为窗体验证--> <forms name=".ASPXAUTH" loginUrl="~/login.aspx" protection="All" timeout="60" p

转:system.Security.Cryptography C# 加密和解密

以下文转自: http://www.360doc.com/content/13/0122/05/19147_261678471.shtml 总结:注册的时候经过MD5加密存进数据库,在登录的时候需要先加密输入的密码,再进行和数据库里的比对,因为同一字符串加密后是一样的,并不是无规则的:实例: string name = this.TextBox1.Text;        string pwd = System.Web.Security.FormsAuthentication.HashPassw

dotnetnuke 调用第三方dll出错 System.Security.Permissions.SecurityPermission,型的权限已失败。

在dnn下调用第三方dll的微信sdk ,代码如下: WebClient wc = new WebClient();  wc.Encoding = encoding ?? Encoding.UTF8; wc.DownloadString(url); 在调用 wc.DownloadString(url);时出现 System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, Pu

使用证书部署出现System.Security.Cryptography.CryptographicException 错误解决方案

一.System.Security.Cryptography.CryptographicException: 找不到对象 at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.X509Certificates.X509Utils._LoadCertFromFile(String fileName, In