Security Exception Error

I'm trying to run the Profiler against a web service hosted on one of our development servers. However, when I try to do this, I get the following error message:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +156
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +287
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +174
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +289


Has anyone else seen this before and/or do you know what steps need to be taken to resolve it? Any help would be appreciated.

Thanks,
Mr. D

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Mr D,

    This sounds very similar to the last problem, where w3wp.exe exited because impersonation didn't seem to be working.

    Whatever the answer is, it probably involves some changes to your application's web.config file. There may be a trust level setting that needs to be elevated. Sometimes introducing the profiler dll into your application invalidates the security because it's unmanaged code, so a trust level of at least Medium would be needed to get it working.

    You may also want to try setting debug=true. This works through some security issues sometimes.

    If this does work make sure you make a note of the original settings so you you can change things back and don't replicate the elevated priviliges to your production site!
  • Brian,

    I've got debug=true set, and am still having trouble, so it may be a problem with impersonation, as you suggested. Could you please send me a link to the other thread where this was dealt with so that I can look into this further?

    Thanks!
    Mr. D
Sign In or Register to comment.