Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 46523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:58:45+00:00 2026-05-10T15:58:45+00:00

I am having difficulty reliably creating / removing event sources during the installation of

  • 0

I am having difficulty reliably creating / removing event sources during the installation of my .Net Windows Service.

Here is the code from my ProjectInstaller class:

// Create Process Installer ServiceProcessInstaller spi = new ServiceProcessInstaller(); spi.Account = ServiceAccount.LocalSystem;  // Create Service ServiceInstaller si = new ServiceInstaller(); si.ServiceName = Facade.GetServiceName(); si.Description = 'Processes ...'; si.DisplayName = 'Auto Checkout'; si.StartType = ServiceStartMode.Automatic;  // Remove Event Source if already there if (EventLog.SourceExists('AutoCheckout'))     EventLog.DeleteEventSource('AutoCheckout');  // Create Event Source and Event Log      EventLogInstaller log = new EventLogInstaller(); log.Source = 'AutoCheckout'; log.Log = 'AutoCheckoutLog';  Installers.AddRange(new Installer[] { spi, si, log }); 

The facade methods referenced just return the strings for the name of the log, service, etc.

This code works most of the time, but recently after installing I started getting my log entries showing up in the Application Log instead of the custom log. And the following errors are in the log as well:

The description for Event ID ( 0 ) in Source ( AutoCheckout ) 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.

For some reason it either isn’t properly removing the source during the uninstall or it isn’t creating it during the install.

Any help with best practices here is appreciated.

Thanks!

In addition, here is a sample of how I am writing exceptions to the log:

// Write to Log EventLog.WriteEntry(Facade.GetEventLogSource(), errorDetails, EventLogEntryType.Error, 99); 

Regarding stephbu’s answer: The recommended path is an installer script and installutil, or a Windows Setup routine.

I am using a Setup Project, which performs the installation of the service and sets up the log. Whether I use the installutil.exe or the windows setup project I believe they both call the same ProjectInstaller class I show above.

I see how the state of my test machine could be causing the error if the log isn’t truly removed until rebooting. I will experiment more to see if that solves the issue.

Edit: I’m interested in a sure fire way to register the source and the log name during the installation of the service. So if the service had previously been installed, it would remove the source, or reuse the source during subsequent installations.

I haven’t yet had an opportunity to learn WiX to try that route.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T15:58:46+00:00Added an answer on May 10, 2026 at 3:58 pm

    The best recommendation would be to not use the Setup Project in Visual Studio. It has very severe limitations. I had very good results with WiX

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 99k
  • Answers 99k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use "git mergetool" for merging, and in modern… May 11, 2026 at 7:46 pm
  • Editorial Team
    Editorial Team added an answer I'd use two iterations over the tree, although it's probably… May 11, 2026 at 7:46 pm
  • Editorial Team
    Editorial Team added an answer No. You need to use threads to execute multiple paths… May 11, 2026 at 7:46 pm

Related Questions

I am having difficulty determining if the body of a text email message is
I am having difficulty writing a Stored Procedure that will query a list of
I've stumbled on this algorithm recently and am having difficulty explaining it to myself.
I have been trying to tackle this problem , but I am having difficulty

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.