473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Tried everything - "Requested registry access is not allowed"

LP
Hi,

My webservice is currently deployed on WIndows 2000 server and runs pretty
fine. I am trying to run my webservice on a Windows 2003 server. My
webservice tries to write to a eventlog. The code is as follows:

System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog(
EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.",
System.Diagnostics.EventLogEntryType.Information );

I am getting the following error.

System.Security.SecurityException: Requested registry access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName, String machineName, Boolean useMutex)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()

I tried the following:
1. Giving full rights to ASPNET account on
HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.

Nothing worked.

If u have solution please reply ASAP.

Thanks
LP
Nov 21 '05 #1
4 46358
Just for kicks, change the:

HKLM\System\CurrentControlSet\Services\Eventlog

key so that "Everyone" has full access and try it then.

"LP" <LP@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Hi,

My webservice is currently deployed on WIndows 2000 server and runs pretty
fine. I am trying to run my webservice on a Windows 2003 server. My
webservice tries to write to a eventlog. The code is as follows:

System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog(
EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.",
System.Diagnostics.EventLogEntryType.Information );

I am getting the following error.

System.Security.SecurityException: Requested registry access is not
allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName, String machineName, Boolean useMutex)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()

I tried the following:
1. Giving full rights to ASPNET account on
HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.

Nothing worked.

If u have solution please reply ASAP.

Thanks
LP

Nov 21 '05 #2
LP
Hi,

I figured out the problem. It was improper access rights (in the event log)
to the account the webservice was running under. When I started looking into
the IIS, I found that the Default application pool ran under the identity of
"Network Service" which is the least priveleged account. Hence it has minimal
access i.e security associated to it is high. This did not allow creating a
new event log and writing into it. I have several options which we can decide
to utilise:

1.Change IIS Isolation Mode Setting:
Right click on "WebSites" under IIS 6.0. Then Click to open the "Service"
tab. Check the chekcbox labelled "Run WWW service in IIS 5.0 isolation
mode.". Click OK and then restart IIS. This will allow your app to run in IIS
5.0 mode.
2. Change IIS Application Pool Setting:
Click on Application Pools under IIS. Right click on the "DefaultAppPool".
Go to the "Identity" tab, and change the Predefined value to "LocalSystem".
CLick Yes on the warning and Click OK.
3. Change Registry setting:
Go to "HKEY_LOCAL_MACHINE\System\CurrentCOntrolSet\Event Log". RIght click
on "eventLog" and choose "permissions". Click on the "Advanced" tab below.
This will open the "Advanced Security settings for event log" dialog box.
Click on the "Add" button in the "Permissions" tab. This will open the
"Select USer or Group" dialog box. Click "Advanced" button and find the
"NETWORK SERVICE" account. Select this account and click on OK. Confirm the
account by clicking OK on the "Select User or Group" dialog box. This will
open the "Permission entry for event log" dialog box. Check on the "Set
Value" and "Create SUbkey" items and click on OK. Now confirm on all the
underlying dialog boxes by clicking on OK.
I feel the last one is the best solution.

THanks
LP
"Scott M." wrote:
Just for kicks, change the:

HKLM\System\CurrentControlSet\Services\Eventlog

key so that "Everyone" has full access and try it then.

"LP" <LP@discussions.microsoft.com> wrote in message
news:07**********************************@microsof t.com...
Hi,

My webservice is currently deployed on WIndows 2000 server and runs pretty
fine. I am trying to run my webservice on a Windows 2003 server. My
webservice tries to write to a eventlog. The code is as follows:

System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog(
EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.",
System.Diagnostics.EventLogEntryType.Information );

I am getting the following error.

System.Security.SecurityException: Requested registry access is not
allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName, String machineName, Boolean useMutex)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message,
EventLogEntryType
type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()

I tried the following:
1. Giving full rights to ASPNET account on
HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.

Nothing worked.

If u have solution please reply ASAP.

Thanks
LP


Nov 21 '05 #3
A better way to do this is to put the event log writing code in a fully
trusted assembly, and attribute it to With
AllowPartiallyTrustedCallersAttribute.

--------------------
Thread-Topic: Tried everything - "Requested registry access is not allowed"
thread-index: AcTDHRlsTLtD0O4QQiy1g2fAjbWA5g==
X-WBNR-Posting-Host: 164.164.12.225
From: "=?Utf-8?B?TFA=?=" <LP@discussions.microsoft.com>
Subject: Tried everything - "Requested registry access is not allowed"
Date: Fri, 5 Nov 2004 01:52:02 -0800
Lines: 43
Message-ID: <07**********************************@microsoft.co m>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7257
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Hi,

My webservice is currently deployed on WIndows 2000 server and runs pretty
fine. I am trying to run my webservice on a Windows 2003 server. My
webservice tries to write to a eventlog. The code is as follows:

System.Diagnostics.EventLog Log = new System.Diagnostics.EventLog(
EventLogName );
Log.Source = EventLogName;
Log.WriteEntry( "PCHistory Service Application started up successfully.",
System.Diagnostics.EventLogEntryType.Information );

I am getting the following error.

System.Security.SecurityException: Requested registry access is not allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(Stri ng source, String
logName, String machineName, Boolean useMutex)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category, Byte[] rawData)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID, Int16 category)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type, Int32 eventID)
at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType
type)
at PCHistory.PCHistoryService.Log(String Message, EventLogEntryType type)
at PCHistory.PCHistoryService.LogInfo(String Message, Object[] args)
at PCHistory.PCHistoryService..ctor()

I tried the following:
1. Giving full rights to ASPNET account on
HKLM\System\CurrentControlSet\Services\Eventlog
2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
3.Changing machine .config process model attribute of USerName to SYSTEM.
4. Creating the Source manually in the registry.

Nothing worked.

If u have solution please reply ASAP.

Thanks
LP

Nov 23 '05 #4

Hi,
try this way you may resolve that error

just goto control panel->Administartive tools->eventLog
delete all the application/systems events

and if you have used in your application like
Eventlog(ServiceConfig)

in business logic

BeginTransaction()
{
}
rollback transaction()
{

}
committransction()
{

}
endtransaction()
{
}
you should have to comment like

BeginTransaction()
{

/* some set of codes... */
}
rollback transaction()
{

/* some set of codes... */

}
committransction()
{
/* some set of codes... */

}
endtransaction()
{
/* some set of codes... */

}

if your os is XP means it works fine without commenting now you are
using windows 2000 server so try my way

Thanks
Annadurai.S

--
Annadurai.S
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1204708.html

Dec 29 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Lutz | last post by:
Hi All, I have a Windows Service that runs well. The service hosts a remote object. The purpose of the object is so that I can "peak" into the service to see what it's doing. I wrote a small...
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
1
by: HK | last post by:
I am exceuting the following command in C# using Microsoft.Win32; RegistryKey key = Registry.LocalMachine.OpenSubKey(KeyName); I keep getting the exception "Requested registry access is not...
3
by: bfprog | last post by:
Using IBM iSeries client access OLEDB provider to connect to DB2 on AS/400, but cannot create connection using .NET web app. Using following code: Dim cnTest As New...
7
by: Peter Ritchie | last post by:
I'm writing a Web Service and I would like to add performance counter data for monitoring performance of the Web Service's operations over time and load. The problem is, I get the "Requested...
0
by: Flinker | last post by:
When attempting to read the System event log on a remote system, I receive a "Requested registry access is not allowed" exception. I temporary added myself as an administrator to the remote system...
8
by: burut | last post by:
Hi, I have index.php page (attached). The flow is when I put username/password on the page, it will submit to be processed by connection.php where in connection.php, it require koneksi_db.php to...
0
by: swatitalati | last post by:
Hello when i invoke a method of web service i m getting error like Server was unable to process request. --> Requested registry access is not allowed. syntex for invoking method is as below ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.