Hi,
I am getting the following error when I try to start the windows service I have written:
ReadOutlookServ ice on local computer started and then stopped.Some services stop automatically if they have no work to do, for example the Performance logs and alerts service.
My Service.cs contains the following: -
protected override void OnStart(string[] args)
-
{
-
// TODO: Add code here to start your service.
-
eventLog1.WriteEntry("ReadOutLookService OnStart");
-
-
tm.Enabled = true;
-
//tm.Start;
-
tm.Elapsed += new ElapsedEventHandler(Timer_Elapsed);
-
}
-
-
protected void Timer_Elapsed(object sender,
-
System.Timers.ElapsedEventArgs e)
-
{
-
try
-
{
-
//eventLog1.WriteEntry("Timer started");
-
_Application olApp = new ApplicationClass();
-
_NameSpace olNs = olApp.GetNamespace("MAPI");
-
MAPIFolder oInbox = olNs.GetDefaultFolder(OlDefaultFolders.olFolderInbox);
-
Items oItems = oInbox.Items;
-
for (int i = 1; i <= oItems.Count; i++)
-
{
-
_MailItem oMail = (_MailItem)oItems.Find("DTE Time Reminder");
-
oMail.Display(false);
-
}
-
-
}
-
catch (System.Exception ex)
-
{
-
throw (ex);
-
}
-
}
-
How do I debug the service ? The service gets installed, but I am not able to run it, since it starts and stops immediately.
Thanks in advance,
mrk
5 3455 PRR 750
Recognized Expert Contributor
Hi,
1. Try and log the error in a text file. -
try{
-
-
}
-
catch(Exception)
-
{
-
// code to log text file
-
}
-
2. Check the service account. It should have permission to write to event logs and file system.
Hi,
Can you elaborate how I can give permission to the ServiceAccount to write to eventlog or file system ? I have used LocalSystem account.
Thanks,
mrk
Can anybody give some pointers ? I just want to create and run a simple windows service..
PRR 750
Recognized Expert Contributor
Hi,
Run the service under "LocalSystem"(f or testing, later on maybe you can change it to some other account). This is the highest account( most privileged). Try and run the code in a console application, see if you find any bugs. If it runs fine, then maybe its a rights issue. Creating Winsows service (look into ServiceAccount) .
Plater 7,872
Recognized Expert Expert
Generally when your service produces that "error" about starting and stopping, it means it had no work to do. Which would lead me to believe there is trouble in your OnStart call, in that the service control doesn't believe you are trying to do anything. Your timer_elapsed function might not be recognized as a true thread that does work?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: B Golash |
last post by:
Hi
I`m trying to install a third-party control. During
the install I receive this error...see the url below.
I have no idea as to the meaning of the error.
www.woodsolutions.com/download/ErrorLoadComp.jpg
|
by: Jagdeesh |
last post by:
Hai Colleagues,
I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've
transferred a set of folders(containing jsp files) into tomcat's
webapps directory(to /webapps/bob , /webapps/sue) and i have added the
folders bob, sue in my server.xml(in the context path).
When i am trying to run jsp files from my browser, it works fine. But,
the following jsp files reports some exceptions which is quite hard to
understand. Here is...
|
by: Richard Steele |
last post by:
I have created a WinForm application that needs to be run as a windows
service (the PC is inaccesible by any user) i have successfully installed the
application as a windows service. When i start the service, i get the
following error
Error 1053: The service did not respond to the start or control request in a
timely fashion
1. Is there anyway to extend the timeout period.? I use timed threads to
load a serial device driver and this...
|
by: Chris |
last post by:
I posted this in the C# language group, then thought it
might be more appropriate in this group. I would not
cross-post except I want the answer so badly.
I built small C# Web and Web Service applications in a
training class last week. The applications worked in the
class, but when I tried to run them again over the
weekend, they both bombed. Instead of getting my Web
page, or the Web Service page, I get a page full of error
text...
|
by: Wolfgang Kaml |
last post by:
I am not sure if this is more of an expert question, but I am sure that they
are out there.
I'd like to setup a general application or bin directory on my Win2003.Net
Server that will hold some useful utils that more pages on that server can
use.
As an example, I have created a Page Counter class that opens an Access .mdb
file, counts the current entries for that page, and adds a new entry with
some information regarding the current...
| |
by: coosa |
last post by:
Hi,
I was installing SQL Server on my machine and during installation my PC
freezed. It happens frequently on my machine. So i tried after
restarting to install it again and since then i always get the same
error message:
"An error occurred while creating one or more registry entries. Please
see C:\WINDOWS\sqlstp.log for details. The problem could be caused by a
low registry quota condition"
I have tried to clean the registry and i...
|
by: Kevin D. |
last post by:
Please note, I already posted this on the MySQL official forum, but received
no response. I thought I'd try again in another location. My apologies to
anyone reading this twice...
Despite everything I've tried, I cannot get MySQL to start as a Windows
service. However, I AM able to get it started via the mysqld-nt --console
command.
Here is my (funky) setup:
|
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 specific error occured: 0." How do I (if it is possible)
change the value of the zero to something custom (like a "look in the event
log for further information" message)?
Thank you,
|
by: =?Utf-8?B?cm9zczYxMw==?= |
last post by:
I'm puzzled by an error message encountered while creating a Windows Service.
In particular, I'm creating a second Windows Service within a Windows
Service project, using Visual Studio 2005. The first service works fine.
The second service appears to be registered correctly; yet I get the "System
error 1083 has occurred." doing a "NET START ServiceName" in the DOS window
along with:
"The executable program that this service is...
|
by: Frinavale |
last post by:
I thought it would be nice to share the solution to my IIS headache with the rest of the world.
I have developed a web application that has been distributed. Upon installing my application, some people encountered a "500 Internal Error" and of course blamed my software immediately (and got frustrated when uninstalling/reinstalling my software didn't fix the problem). Finally I was able to take a look at one of these computers and discovered...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |