472,340 Members | 1,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,340 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 13327
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...
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...
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...
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...
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...
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...
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...
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...
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...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.