By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,127 Members | 1,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,127 IT Pros & Developers. It's quick & easy.

An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll Additional information: Requested registry access is not allowed.

P: n/a
This is my problem. I am using Visual 2003, .Net framework 1.1 and the
Application Block
I configured the DAAB using the Enterprise Library Configuration

now this is the error which is coming

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: Requested registry
access is not allowed.

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: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
System.Diagnostics.EventLog.FindSourceRegistration (String source, String
machineName, Boolean readOnly)
System.Diagnostics.EventLog.SourceExists(String source, String machineName)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.PerformanceCounte
rInstances.ReportCounterFailure(String message)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.PerformanceCounte
rInstances..ctor(String categoryName, String counterName, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
..AddPerformanceCounter(String category, String[] counterNames, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
..Initialize(String counterCategory, String[] counterNames, Boolean
createNewInstance, String eventLogSource, EventLogIdentifier[] eventIds)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
...ctor(String counterCategory, String[] counterNames, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataServiceEvent..c
tor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataCommandFailedEv
ent..ctor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataCommandFailedEv
ent..cctor()
Apr 5 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi Ankit,

Thank you for posting.

From your description, I understand that you have an ASP.NET web
application which use the enterprise library and DAAB. However, at runtime,
you're encountering some System.SecurityException, correct?

Based on the error message and callstack, the exception occured when the
code try accessing certain windows registry entry. So this is a security
permission problem. I suggest you try the following steps first:

1. Change your ASP.NET application's process idenitity to LOCAL SYSTEM and
run it to see whether the problem still occurs. If still occurs, that means
this is not a raw windows security issue, but a .NET code access security
issue. If the problem go away, we need to check the original process
identity's windows permission to the registry.

2. If we've confirmed that this is a .NET CAS issue through #1, we need to
check our asp.net application's Trust Level first, is your ASP.NET
application running under "Full" trustlevel? The trust level can be
configured in the web.config(or machine.config) through the <trust> element:

#trust Element (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/lib...93(VS.80).aspx

If the original value is not set as "Full" , you can manually set the
application's Trust level to "Full", like below:

<trust
level="Full"
/>
After that, test the application again to see whether it can run
correctly(access the registry correctly).

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Apr 6 '06 #2

P: n/a
can u give me steps how i will perform the first step
code id running fine on other system
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:6Q**************@TK2MSFTNGXA01.phx.gbl...
Hi Ankit,

Thank you for posting.

From your description, I understand that you have an ASP.NET web
application which use the enterprise library and DAAB. However, at
runtime,
you're encountering some System.SecurityException, correct?

Based on the error message and callstack, the exception occured when the
code try accessing certain windows registry entry. So this is a security
permission problem. I suggest you try the following steps first:

1. Change your ASP.NET application's process idenitity to LOCAL SYSTEM and
run it to see whether the problem still occurs. If still occurs, that
means
this is not a raw windows security issue, but a .NET code access security
issue. If the problem go away, we need to check the original process
identity's windows permission to the registry.

2. If we've confirmed that this is a .NET CAS issue through #1, we need to
check our asp.net application's Trust Level first, is your ASP.NET
application running under "Full" trustlevel? The trust level can be
configured in the web.config(or machine.config) through the <trust>
element:

#trust Element (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/lib...93(VS.80).aspx

If the original value is not set as "Full" , you can manually set the
application's Trust level to "Full", like below:

<trust
level="Full"
/>
After that, test the application again to see whether it can run
correctly(access the registry correctly).

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Apr 6 '06 #3

P: n/a
i also tried this line
<identity impersonate="false" />
in web.comfig but doesn't work

"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:6Q**************@TK2MSFTNGXA01.phx.gbl...
Hi Ankit,

Thank you for posting.

From your description, I understand that you have an ASP.NET web
application which use the enterprise library and DAAB. However, at
runtime,
you're encountering some System.SecurityException, correct?

Based on the error message and callstack, the exception occured when the
code try accessing certain windows registry entry. So this is a security
permission problem. I suggest you try the following steps first:

1. Change your ASP.NET application's process idenitity to LOCAL SYSTEM and
run it to see whether the problem still occurs. If still occurs, that
means
this is not a raw windows security issue, but a .NET code access security
issue. If the problem go away, we need to check the original process
identity's windows permission to the registry.

2. If we've confirmed that this is a .NET CAS issue through #1, we need to
check our asp.net application's Trust Level first, is your ASP.NET
application running under "Full" trustlevel? The trust level can be
configured in the web.config(or machine.config) through the <trust>
element:

#trust Element (ASP.NET Settings Schema)
http://msdn2.microsoft.com/en-us/lib...93(VS.80).aspx

If the original value is not set as "Full" , you can manually set the
application's Trust level to "Full", like below:

<trust
level="Full"
/>
After that, test the application again to see whether it can run
correctly(access the registry correctly).

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Apr 6 '06 #4

P: n/a
Ankit Aneja wrote:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the
Application Block
I configured the DAAB using the Enterprise Library Configuration

now this is the error which is coming

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: Requested registry
access is not allowed.

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: Requested registry access is not allowed.]
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
System.Diagnostics.EventLog.FindSourceRegistration (String source, String
machineName, Boolean readOnly)
System.Diagnostics.EventLog.SourceExists(String source, String machineName)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID)
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.PerformanceCounte
rInstances.ReportCounterFailure(String message)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.PerformanceCounte
rInstances..ctor(String categoryName, String counterName, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
.AddPerformanceCounter(String category, String[] counterNames, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
.Initialize(String counterCategory, String[] counterNames, Boolean
createNewInstance, String eventLogSource, EventLogIdentifier[] eventIds)
Microsoft.Practices.EnterpriseLibrary.Common.Instr umentation.InstrumentedEvent
..ctor(String counterCategory, String[] counterNames, Boolean
createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataServiceEvent..c
tor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataCommandFailedEv
ent..ctor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrum entation.DataCommandFailedEv
ent..cctor()

hey Ankit,
this is the problem of registry settings in Enterprise Library.
Just run the batch file of "Install Services" provided in the Enterprise
Library. I hope it may solve ur problem.
Regards,
Sandeep
Apr 6 '06 #5

P: n/a
Thanks for your response Ankit,

What's your webserver's OS version and is it using IIS5 or IIS6? As for
the step1 I mentioned before, it depend on the IIS server your application
running against. For IIS 5, it use the ASP.NET processModel, you can change
ASP.NET process idenitity through the <processModel> element in the
machine.config file. For IIS6, it by default use applicationPool model, so
you can just configure your ASP.NET application(virutal dir)'s application
pool's idenitity account. Change the account to LocalSystem and test it to
see whether it works

for IIS5
#<processModel> Element
http://msdn.microsoft.com/library/en...cessmodelsecti
on.asp?frame=true
for IIS6
#Identity Application Pool Settings
http://msdn.microsoft.com/library/en...tityapplicatio
npoolsettings.asp?frame=true

if change process idenitity to run under LOCALSYSTEM not work, you should
check the .NET CAS setting as I mentioned in step2:

#ASP.NET Trust Levels and Policy Files
http://msdn.microsoft.com/library/en...ettrustlevelsp
olicyfiles.asp?frame=true
Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Apr 6 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more ASP.NET Questions on Bytes