equested registry access is not allowed (using Enterprise Library)

  • Thread starter Andrés Cadavid Gómez
  • Start date
A

Andrés Cadavid Gómez

Hello,

im using the enterpirse Library - July 2005 and when i had published my
application in the production server, i got this error:

Exception Details: System.Security.SecurityException: Requested registry
access is not allowed.

Im using the configuration, data, exception blocks.

Can anyone help me what i do ?

I cant modify the server registry, i need a solution with least privilege
possible.

Thank you.
 
J

Joseph Bittman MCSD

August 6, 2005

You will need to grant access in two ways:

#1 through Code Access Security
#2 Set the appropriate NTFS permissions

To start with #2, do you need widespread access to the registry? If you only
need to access a few nodes, you can type RegEdit at the Run prompt and then
scroll to your node and set the permissions you need by going to the
Security tab on the Properties page.

For #1, the method depends on how you have your machine configured. For
starters, what setting do you have your web application running from?
Trusted Sites, Intranet, etc?

Hope this helps you!

--
Joseph Bittman
Microsoft Certified Solution Developer

Web Site: http://71.39.42.23
Static IP
 
J

Joe Kaplan \(MVP - ADSI\)

Is Enterprise Library trying to create an event log when this happens? This
problem is very common with code that attempts to create an event log since
that operation requires administrative privileges and the web application
generally does not have them.

Joe K.
 
Q

qjchen

Yes, I figured out this part.

It is trying to create an Event Source "Enterprise Library
Instrumentation"

So I went to the Registry and manually created this Key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\Enterprise
Library Instrumentation.

After the registry key is created. The program does NOT get the
SecurityException anymore.

BUT, now I get error in the event log:

The description for Event ID ( 0 ) in Source ( Enterprise Library
Instrumentation ) cannot be found. The local computer may not have the
necessary registry information or message DLL files to display messages
from a remote computer. You may be able to use the /AUXSOURCE= flag to
retrieve this description; see Help and Support for details. The
following information is part of the event: Failed to create instances
of performance counter 'Total Command Executions' - The requested
Performance Counter is not a custom counter, it has to be initialized
as ReadOnly...

My guess is that I have to run the InstallService.bat. But I don't have
anything on the server - no VStudio, Enterprise Library source.

Any insight?

John
 
J

Joe Kaplan \(MVP - ADSI\)

I can't remember the details, but Ent Lib is supposed to be set up on the
machine it is being run on BEFORE you start actually using it. This set up
installs the event logs, perf counters and WMI info in advance. There is a
tool that comes with Ent Lib that will do this for you. If that is not done
in advance, it tries to do that for you, but may fail due to security
limitations.

The other alternative is to create a build of Ent Lib with all of the
instrumentation turned off (which can be done with a preprocessor variable
as I recall).

I'm sure there are tons of posts covering this stuff over at the ent lib
forum at www.gotdotnet.com or probably even in the docs that came with it.

Joe K.
 
Q

qjchen

I am back on this issue and finally found the solution.

Run the InstallUtil against each assembly.

What I did is follow the same step as InstallService.bat so I won't
miss anything. The InstallService.bat refers to the Visual Studio which
I don't have it on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top