Reputation: 359
I am facing an issue while trying a simple ASP.NET default application on the server. This is a fresh new server.
I get the error - 4010 An unhandled security exception has occurred.
There are no error details to it. I have seen few websites which tried to relate the error to cache, however i don't have any cache in use.
On the local machine everything seems to be working fine. Any suggestions ?
Upvotes: 7
Views: 13891
Reputation: 1
I had to change the trust level from medium to high in the Web.config and solved issue
Reason :Full: Specifies unrestricted permissions and grants the ASP.NET application permissions to access any resource that is subject to operating system security; all privileged operations are supported
Upvotes: 0
Reputation: 1275
In IIS, try increasing your site's .NET Trust Level to Full (internal).
Upvotes: 3
Reputation: 448
I had this issue today and it was due to my asp.net application wanting to write to the Windows Event Log. The Event Source didn't exist and my application didn't have the permissions to create it so it errored with this message:
Event code: 4010 Event message: An unhandled security exception has occurred.
The fix for me was to create the Event Source and my application started working. I followed the steps from the below answer to manually create the Event Source via the command line:
How to create Windows EventLog source from command line?
Upvotes: 6
Reputation: 7804
You should try to enable trace or custom logging and see what the exception stack trace is. ELMAH or Glimpse are useful if you don't have access to the production system.
http://www.iis.net/configreference/system.webserver/tracing
You might try to change the trust level from medium to high in the Web.config.
http://msdn.microsoft.com/en-us/library/tkscy493(v=vs.85).aspx
Microsoft has this info for how to log these exceptions to the Application log
unhandled exceptions cause ASP.NET-based applications to quit unexpectedly in the .NET Framework
Upvotes: 0