Strange ASP.NET error !

2019-04-11 09:14发布

问题:

I'm running Windows 7 - x64 Edition with IIS 7.5

I have a simple asp.net website that i've run on other versions of windows and IIS but now, on SOME pages it gives me the following error

Exception information: Exception type: HttpParseException Exception message: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Stack trace: at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) ......

Now, when i run this application under cassini everything works fine. I also was able to figure out that where ever i have used the AjaxToolkit controls those pages are throwing this error.

Any advice ?

回答1:

In IIS, Under the advanced settings. You must try to set

Load User Profile=True

see this link for more detail http://geekswithblogs.net/ProjectLawson/archive/2009/05/05/iis-system.web.aspnethostingpermission-exception-on-windows-7-rc.aspx