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

why won't my service stay started

it only behaves as expected if i edit the service to run under the system
account and enable the "allow service to interact with desktop" option. if i
run without that enabled or run it under my currently logged on account it
gives an error saying the service started and then stopped right away. i
just created a new vb.net service and put a timer in it and set the interval
and put some code in the Timer1_Elapsed... the timer is just the default
one of type system.timers.timer , is there another type i should be using
here?

also how come when i hit the debug button it tells me you cannot start the
service from the command line or debugger, and if i wait a few seconds
before hitting ok my timer event fires and i can debug it fine?? is there
some other way to debug it properly?

thanks in advance
Nov 21 '05 #1
5 2888
On Mon, 06 Dec 2004 13:10:18 GMT, "Lance Colton"
<la**********@gmail.nospam> wrote:
it only behaves as expected if i edit the service to run under the system
account and enable the "allow service to interact with desktop" option. if i
run without that enabled or run it under my currently logged on account it
gives an error saying the service started and then stopped right away. i
just created a new vb.net service and put a timer in it and set the interval
and put some code in the Timer1_Elapsed... the timer is just the default
one of type system.timers.timer , is there another type i should be using
here?
What code do you have in the timer?
The most likely thing is that the timer fires and what it does isn't
allowed without desktop interaction
also how come when i hit the debug button it tells me you cannot start the
service from the command line or debugger, and if i wait a few seconds
before hitting ok my timer event fires and i can debug it fine?? is there
some other way to debug it properly?


You can run it from the Service Control Manager and the use "Tools ->
Debug Processes" to attach to it

Vin
Nov 21 '05 #2
code in the timer:

==============
Dim myReader As System.Data.SqlClient.SqlDataReader
SqlConnection1.Open()
SqlCommand1.CommandText = "xxxxxxxxxxxxxxxx"
myReader = SqlCommand1.ExecuteReader()
While myReader.Read()
Debug.WriteLine(myReader.Item(0) & myReader.Item(1) & myReader.Item(2))
End While
myReader.Close()
SqlConnection1.Close()
===============
sure, that debug.writeline stuff isn't going to do anything without the IDE
being open, so you think the exe or windows knew this and 'optimized' my
service by removing the whole timer since it does nothing?

maybe my database connection doesn't work properly with no desktop
interaction and its getting an error and closing right away, or something.

thanks for the info on how to debug it though...

"Vincent Finn" <1@2.com> wrote in message
news:5m********************************@4ax.com...
On Mon, 06 Dec 2004 13:10:18 GMT, "Lance Colton"
<la**********@gmail.nospam> wrote:
it only behaves as expected if i edit the service to run under the system
account and enable the "allow service to interact with desktop" option. if
i
run without that enabled or run it under my currently logged on account it
gives an error saying the service started and then stopped right away. i
just created a new vb.net service and put a timer in it and set the
interval
and put some code in the Timer1_Elapsed... the timer is just the default
one of type system.timers.timer , is there another type i should be using
here?


What code do you have in the timer?
The most likely thing is that the timer fires and what it does isn't
allowed without desktop interaction
also how come when i hit the debug button it tells me you cannot start
the
service from the command line or debugger, and if i wait a few seconds
before hitting ok my timer event fires and i can debug it fine?? is there
some other way to debug it properly?


You can run it from the Service Control Manager and the use "Tools ->
Debug Processes" to attach to it

Vin

Nov 21 '05 #3
code in the timer:

==============
Dim myReader As System.Data.SqlClient.SqlDataReader
SqlConnection1.Open()
SqlCommand1.CommandText = "xxxxxxxxxxxxxxxx"
myReader = SqlCommand1.ExecuteReader()
While myReader.Read()
Debug.WriteLine(myReader.Item(0) & myReader.Item(1) & myReader.Item(2))
End While
myReader.Close()
SqlConnection1.Close()
===============
sure, that debug.writeline stuff isn't going to do anything without the IDE
being open, so you think the exe or windows knew this and 'optimized' my
service by removing the whole timer since it does nothing?

maybe my database connection doesn't work properly with no desktop
interaction and its getting an error and closing right away, or something.

thanks for the info on how to debug it though...

"Vincent Finn" <1@2.com> wrote in message
news:5m********************************@4ax.com...
On Mon, 06 Dec 2004 13:10:18 GMT, "Lance Colton"
<la**********@gmail.nospam> wrote:
it only behaves as expected if i edit the service to run under the system
account and enable the "allow service to interact with desktop" option. if
i
run without that enabled or run it under my currently logged on account it
gives an error saying the service started and then stopped right away. i
just created a new vb.net service and put a timer in it and set the
interval
and put some code in the Timer1_Elapsed... the timer is just the default
one of type system.timers.timer , is there another type i should be using
here?


What code do you have in the timer?
The most likely thing is that the timer fires and what it does isn't
allowed without desktop interaction
also how come when i hit the debug button it tells me you cannot start
the
service from the command line or debugger, and if i wait a few seconds
before hitting ok my timer event fires and i can debug it fine?? is there
some other way to debug it properly?


You can run it from the Service Control Manager and the use "Tools ->
Debug Processes" to attach to it

Vin

Nov 21 '05 #4
On Tue, 07 Dec 2004 09:13:38 GMT, "Lance Colton"
<la**********@gmail.nospam> wrote:
code in the timer:

==============
Dim myReader As System.Data.SqlClient.SqlDataReader
SqlConnection1.Open()
SqlCommand1.CommandText = "xxxxxxxxxxxxxxxx"
myReader = SqlCommand1.ExecuteReader()
While myReader.Read()
Debug.WriteLine(myReader.Item(0) & myReader.Item(1) & myReader.Item(2))
End While
myReader.Close()
SqlConnection1.Close()
===============
sure, that debug.writeline stuff isn't going to do anything without the IDE
being open, so you think the exe or windows knew this and 'optimized' my
service by removing the whole timer since it does nothing?
Doubt if it is allowed do that since it can't tell that the function
calls don't do other things
and if the code was all removed then your service would run perfectly
(doing nothing but still running)
maybe my database connection doesn't work properly with no desktop
interaction and its getting an error and closing right away, or something.


sounds more likely
might be worth rephrasing the question with emphasis on the
SqlDataReader class with no desktop
I have never used it so I can't really offer any suggestions

Vin
Nov 21 '05 #5
On Tue, 07 Dec 2004 09:13:38 GMT, "Lance Colton"
<la**********@gmail.nospam> wrote:
code in the timer:

==============
Dim myReader As System.Data.SqlClient.SqlDataReader
SqlConnection1.Open()
SqlCommand1.CommandText = "xxxxxxxxxxxxxxxx"
myReader = SqlCommand1.ExecuteReader()
While myReader.Read()
Debug.WriteLine(myReader.Item(0) & myReader.Item(1) & myReader.Item(2))
End While
myReader.Close()
SqlConnection1.Close()
===============
sure, that debug.writeline stuff isn't going to do anything without the IDE
being open, so you think the exe or windows knew this and 'optimized' my
service by removing the whole timer since it does nothing?
Doubt if it is allowed do that since it can't tell that the function
calls don't do other things
and if the code was all removed then your service would run perfectly
(doing nothing but still running)
maybe my database connection doesn't work properly with no desktop
interaction and its getting an error and closing right away, or something.


sounds more likely
might be worth rephrasing the question with emphasis on the
SqlDataReader class with no desktop
I have never used it so I can't really offer any suggestions

Vin
Nov 21 '05 #6

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

Similar topics

2
by: 0to60 | last post by:
I have a windows service that when started creates two threads: one thread that runs a TcpListener waiting for TcpClients to connect, and another thread that reads from the resulting sockets. My...
0
by: Victor Marquez | last post by:
Hi All, We have been experiencing problems with StateServer. The service is hanging-up and stops responding further requests. Facts: - There are not events in Application Logs (not...
4
by: Niron kag | last post by:
Hi, I have a windows service, which is currently installed, on my local computer. The problem is that when I look at the task manager, I see that the “Mem Usage”, become bigger and bigger....
4
by: minoad | last post by:
I have written a program that runs perfectly. I converted this to a service. Upon starting the service, it will stay indefinantly on "Starting" and never move to "Started". The wierd thing here...
1
by: Karch | last post by:
I am writing a WCF Service using MSMQ hosted in a Windows Service on Windows XP. All the required components are installed (.NET3, MSMQ, etc). For some reason my service tries to start and then...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
10
by: archana | last post by:
Hi all, I am having one windows service which is updating to database. On 'Onstop i want to wait till current updation complete. How will i do this? Because if i write some lengthy code on...
3
by: Anil Gupte | last post by:
I am having a problem getting a service to stay on and I cannot debug it. I installed it on a computer using installutil.exe In the Services list, it appears just fine, and I can hit start. ...
4
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
I've written a .net Windows service in C#. It works most of the time for most people. It is configured to automatically start when Windows boots. Sometimes it fails to start on Windows XP during...
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
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
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 projectplanning, 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.