473,395 Members | 1,870 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,395 software developers and data experts.

C# Application not allowed to write to event log on Windows Server 2003

Dear Team,

I am running Visual Studio 2003 Version 7.1.3088 on Windows Server 2003.

I have written a C# application that must write to the event log. When it attempts to write to the event log, however, I get the following message on the browser shown below in bold text:

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:

Line 107:
Line 108: public void Application_OnStart() {
Line 109: EventLog.WriteEntry("CSharpASP", "CSharpASP application Starting");
Line 110: DirectoryInfo di = null;
Line 111: try

I have searched the help on Visual Studio.NET and the MSDN Library. The only thing close to explaining how to set the security on the application event log is the following:

Prevent local guests group from accessing application log

Description
This security setting determines if guests are prevented from accessing the application event log.

Notes

This setting does not appear in the Local Computer Policy object.
This security setting affects only computers running Windows 2000 and Windows XP.
Default: Enabled.

Configuring this security setting
You can configure this security setting by opening the appropriate policy and expanding the console tree as such: Computer Configuration\Windows Settings\Security Settings\Event Log\

For specific instructions about how to configure security policy settings, see To edit a security setting on a Group Policy object.

For more information, see:

Event Viewer
Security Configuration Manager Tools

However, this appears to relate to an earlier version of Windows Server, as I cannot find the 'console tree' mentioned.

So, my question is: Can you please direct me to where I can alter the security properties of the Application Event Log in Windows Server 2003? Please note, I have opened the Event Viewer and that does not allow security levels to be altered.

Thanks,

Tom.

Jul 21 '05 #1
2 13462
Hi Tom,

Thanks for your post. As I understand, the problem you are facing is that
it failed to write to event log within an ASP .NET Web application. Please
correct me if there is any misunderstanding. Now I'd like to share the
following information with you:

By default, the NetworkService account, which is the user token of the
ASP.NET worker process in Windows 2003, does not have the correct user
rights to create an event source. That's the reason why you receive that
error message. To resolve this problem, you should create a registry key
CSharpASP under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Application,
say:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Application\CS
harpASP

Please refer to the following KB article for detailed information:

PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
Application Tries to Write New EventSource in the EventLog
http://support.microsoft.com/?id=329291

Hope this helps.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
Tian,

This did the trick!

Thanks,

Tom.

"Tian Min Huang" <ti******@online.microsoft.com> wrote in message
news:Ut**************@cpmsftngxa06.phx.gbl...
Hi Tom,

Thanks for your post. As I understand, the problem you are facing is that
it failed to write to event log within an ASP .NET Web application. Please
correct me if there is any misunderstanding. Now I'd like to share the
following information with you:

By default, the NetworkService account, which is the user token of the
ASP.NET worker process in Windows 2003, does not have the correct user
rights to create an event source. That's the reason why you receive that
error message. To resolve this problem, you should create a registry key
CSharpASP under
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Application,
say:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Eventlog\Application\CS harpASP

Please refer to the following KB article for detailed information:

PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
Application Tries to Write New EventSource in the EventLog
http://support.microsoft.com/?id=329291

Hope this helps.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3

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

Similar topics

7
by: Lucas | last post by:
Hi, I have an ASP.Net application written with VS.Net 2002 (Net FWK 1.0). This Web Application uses Exception Management Application Block to log Events to Windows Event Log. We registered the...
3
by: cjk | last post by:
Issue Our web application requires access to write to a custom event log, yet access is denied. This access is denied because we are using impersonation, and our end-users do not (should not) have...
2
by: EricJ | last post by:
Hi all, I'm having problems deploying my asp.NET site to a windows server 2003. Deploying on a 2000 server or an xp pro never gave me any problems but now im stuck. I used a web setup to...
2
by: Jared Hagel | last post by:
I've searched the web for a solution to this problem. Surprisingly, no problem/solution has been posted yet. We can read application configuration information fine when our asp.net application...
4
by: FrodoBaggins | last post by:
Dear Team, I am running Visual Studio 2003 Version 7.1.3088 on Windows Server 2003. I have written a C# application that must write to the event log. When it attempts to write to the event log,...
0
by: KeithZ | last post by:
I have created a very simple vb.net web service. It works fine on my local machine and every other machine I have installed it on. For the life of me I cannot get it to work on my production...
9
by: Brian Delahunty | last post by:
I'm having a bit of a weird problem and I've spent the last few hours scouring the web trying to solve this before coming here. Here is the problem: I get 404 errors for all ASP.NET 2.0 content...
0
by: Sridhar | last post by:
Hi, We are trying to purchase VS 2005 64 bit version. When we create web applications using 64 bit VS 2005, do we need to have 64 bit IIS server and/or 64 bit sql server to run those...
3
by: Julia | last post by:
Hi I have an asp.net application that I send to my customer for installataion on his Windows Server 2003. The installation is working fine but when he tries to browse the login.aspx page he gets...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.