473,405 Members | 2,185 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,405 software developers and data experts.

Specifying a log for a Service

Hi people

I am trying to set the log for my service in the installer class (System.Configuration.Install.Installer). I override Install and Uninstall. The install method looks like this

public override void Install(IDictionary stateSaver

if( !EventLog.SourceExists(MyServiceName)
EventLog.CreateEventSource(MyServiceName, MyLogName)
base.Install(stateSaver)
The MyServiceName is the same as the name of my service

The installer complains "Source MyServiceName already exists on the local computer". But (1) I am explicitely checking whether the source exists before creating the source(!!!), and (2) my log has a completely different name (MyLogName) than the existing logs (Application...), and (3) creating an Event source requires both the source name and the log name. This doesn't seem very logical. The error message

<error_message
[...
Installing service MyServiceName..
Service MyServiceName has been successfully installed
Creating EventLog source MyServiceName in log Application..

An exception occurred during the Install phase
System.ArgumentException: Source MyServiceName already exists on the local computer
[...
</error_message

At line 3 you can see that the installer is creating the source behind my back; for log Application. Then the exception occurs. I seem to be creating a source that already exists, BUT in my code I explicitely CHECK whether the source already EXISTS before creating it. Plus I register the source for ANOTHER log than Application (MyLogName)

Pffff. If I get grey hair before I'm thirty, I'll definitely know why ... Does anyone have any idea

Thank you
Tom
Nov 16 '05 #1
0 2204

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

Similar topics

10
by: Amittai Aviram | last post by:
This XHTML 1.0 Strict page -- http://www.studiolirico.org/docs/settimana2003.html has a bilingual title in Italian and English. The principle language of the page is Italian, so the <html> tag...
6
by: John Bentley | last post by:
John Bentley writes at this level: If we think about our savings accounts then division never comes in (as far as I can see). We deposit and withdraw exact amounts most of the time. Occasionaly...
0
by: Bruno Jouhier | last post by:
I have a standard Web Service developped with ASP .NET and I would like to specify annotations on some properties exposed by my web service, and to have these annotations appear in the WSDL, but I...
0
by: TT (Tom Tempelaere) | last post by:
Hi people I am trying to set the log for my service in the installer class (System.Configuration.Install.Installer). I override Install and Uninstall. The install method looks like this public...
1
by: Adam Eccleshall | last post by:
Hi, I'm trying to write a routine to extract results from a web service written in VS 2005 using XPath, however VS doesn't put a prefix on result namespaces by default, so in the output from a...
4
by: Jason Richmeier | last post by:
I am sure this has been asked at least once before but I could not find anything when searching. If I set the value of the ExitCode property to 1066 for a windows service, the text "A service...
0
by: supercodepoet | last post by:
What I have is a .NET 2.0 C# web service for quoting a tax rate. The current response wrapped in the SOAP envelope and body is : <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
1
by: zufie | last post by:
Hi, I want to specifying a foreign key by altering a table. First, I create an ORDERS table without specifying a foreign key. Here is my code: CREATE TABLE ORDERS (Order_ID integer,...
0
by: clarkemi | last post by:
Have implemented: protected override WebRequest GetWebRequest(Uri uri) { HttpWebRequest request = (HttpWebRequest) base.GetWebRequest(uri); request.KeepAlive = false; return request;...
2
by: Jeff Dege | last post by:
I have a VS2005 Web Site that's giving me some trouble. Our process model requires that all shipped applications be compiled on a dedicated compile box, straight from version control, without...
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: 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
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
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,...
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
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.