473,508 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Debugging windows service on Vista

ink
Hi all,

I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.

What I would normally do is add the following code to my OnStart() but it
does not work on Vista
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif

I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

I have tried it and it seems for be awfully low level.

Can any one help with this.

Thanks,
ink

Nov 2 '07 #1
5 1593
Hi,

What I do (no matter what OS) is that the OnStart does nothing more than
spawn a thread that is where all the work is performed.

In the thread you can use a Sleep to hold for a given time. This allows you
to attach your debug session to the process.
The waiting time is defined in the config file, so if it's 0 you wait
nothing and the process start as expected (this would be teh case when the
process is running alone).

OnStart()
{
new Thread( new ThreadStart( StartingPoint)).Start();
}
void StartingPoint()
{
if ( Configuration.AppSettings["StartDelayTime"] != "0" )
{
Thread.Sleep(
Convert.ToInt32(Configuration.AppSettings["StartDelayTime"] ));
}

.... code
}

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Hi all,

I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.

What I would normally do is add the following code to my OnStart() but it
does not work on Vista
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif

I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

I have tried it and it seems for be awfully low level.

Can any one help with this.

Thanks,
ink

Nov 2 '07 #2
ink

Hi

Thanks for getting back to me.

The process is always greyed out. i cant seem to attach to the running EXE.

Any other sugestions.

Thanks,
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi,

What I do (no matter what OS) is that the OnStart does nothing more than
spawn a thread that is where all the work is performed.

In the thread you can use a Sleep to hold for a given time. This allows
you to attach your debug session to the process.
The waiting time is defined in the config file, so if it's 0 you wait
nothing and the process start as expected (this would be teh case when the
process is running alone).

OnStart()
{
new Thread( new ThreadStart( StartingPoint)).Start();
}
void StartingPoint()
{
if ( Configuration.AppSettings["StartDelayTime"] != "0" )
{
Thread.Sleep(
Convert.ToInt32(Configuration.AppSettings["StartDelayTime"] ));
}

.... code
}

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>Hi all,

I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.

What I would normally do is add the following code to my OnStart() but it
does not work on Vista
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif

I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

I have tried it and it seems for be awfully low level.

Can any one help with this.

Thanks,
ink

Nov 2 '07 #3
Hi,

Are you running your IDE as administrator?

I can attach to the processes without any problem.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:O$**************@TK2MSFTNGP06.phx.gbl...
>
Hi

Thanks for getting back to me.

The process is always greyed out. i cant seem to attach to the running
EXE.

Any other sugestions.

Thanks,
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP06.phx.gbl...
>Hi,

What I do (no matter what OS) is that the OnStart does nothing more than
spawn a thread that is where all the work is performed.

In the thread you can use a Sleep to hold for a given time. This allows
you to attach your debug session to the process.
The waiting time is defined in the config file, so if it's 0 you wait
nothing and the process start as expected (this would be teh case when
the process is running alone).

OnStart()
{
new Thread( new ThreadStart( StartingPoint)).Start();
}
void StartingPoint()
{
if ( Configuration.AppSettings["StartDelayTime"] != "0" )
{
Thread.Sleep(
Convert.ToInt32(Configuration.AppSettings["StartDelayTime"] ));
}

.... code
}

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>Hi all,

I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.

What I would normally do is add the following code to my OnStart() but
it does not work on Vista
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif

I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

I have tried it and it seems for be awfully low level.

Can any one help with this.

Thanks,
ink


Nov 2 '07 #4
ink
Hi,

I am running under my user name that is in the administrator group and i
have turned off the account control junk in Vista so it is defiantly running
as me.

The service is set to run under the local system account and i start it
manually
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:uT**************@TK2MSFTNGP02.phx.gbl...
Hi,

Are you running your IDE as administrator?

I can attach to the processes without any problem.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:O$**************@TK2MSFTNGP06.phx.gbl...
>>
Hi

Thanks for getting back to me.

The process is always greyed out. i cant seem to attach to the running
EXE.

Any other sugestions.

Thanks,
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote
in message news:%2****************@TK2MSFTNGP06.phx.gbl...
>>Hi,

What I do (no matter what OS) is that the OnStart does nothing more than
spawn a thread that is where all the work is performed.

In the thread you can use a Sleep to hold for a given time. This allows
you to attach your debug session to the process.
The waiting time is defined in the config file, so if it's 0 you wait
nothing and the process start as expected (this would be teh case when
the process is running alone).

OnStart()
{
new Thread( new ThreadStart( StartingPoint)).Start();
}
void StartingPoint()
{
if ( Configuration.AppSettings["StartDelayTime"] != "0" )
{
Thread.Sleep(
Convert.ToInt32(Configuration.AppSettings["StartDelayTime"] ));
}

.... code
}

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl.. .
Hi all,

I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.

What I would normally do is add the following code to my OnStart() but
it does not work on Vista
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif

I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx

I have tried it and it seems for be awfully low level.

Can any one help with this.

Thanks,
ink

Nov 2 '07 #5
ink

I didnt have all users ticked.

Now i see it.
Thanks

ink


"ink" <in*@notmyemail.comwrote in message
news:e$*************@TK2MSFTNGP02.phx.gbl...
Hi,

I am running under my user name that is in the administrator group and i
have turned off the account control junk in Vista so it is defiantly
running as me.

The service is set to run under the local system account and i start it
manually
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:uT**************@TK2MSFTNGP02.phx.gbl...
>Hi,

Are you running your IDE as administrator?

I can attach to the processes without any problem.

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:O$**************@TK2MSFTNGP06.phx.gbl...
>>>
Hi

Thanks for getting back to me.

The process is always greyed out. i cant seem to attach to the running
EXE.

Any other sugestions.

Thanks,
ink


"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote
in message news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi,

What I do (no matter what OS) is that the OnStart does nothing more
than spawn a thread that is where all the work is performed.

In the thread you can use a Sleep to hold for a given time. This allows
you to attach your debug session to the process.
The waiting time is defined in the config file, so if it's 0 you wait
nothing and the process start as expected (this would be teh case when
the process is running alone).

OnStart()
{
new Thread( new ThreadStart( StartingPoint)).Start();
}
void StartingPoint()
{
if ( Configuration.AppSettings["StartDelayTime"] != "0" )
{
Thread.Sleep(
Convert.ToInt32(Configuration.AppSettings["StartDelayTime"] ));
}

.... code
}

--
Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.
"ink" <in*@notmyemail.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl. ..
Hi all,
>
I cant seem to debug my windows service on my Vista machine.
It seems it has something to do with 0 Session.
>
What I would normally do is add the following code to my OnStart() but
it does not work on Vista
>
>
#if DEBUG
System.Diagnostics.Debugger.Break();
//System.Diagnostics.Debugger.Launch();
#endif
>
I found this article but I am not sure this is what I am looking for.
http://blogs.msdn.com/cjacks/archive...ows-vista.aspx
>
I have tried it and it seems for be awfully low level.
>
Can any one help with this.
>
Thanks,
ink
>

Nov 2 '07 #6

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

Similar topics

16
4173
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
3
6128
by: illegal.prime | last post by:
Hi all, I have a service that needs to start a regular windows application. I'm running the service as ServiceAccount.LocalSystem. But, when it starts the process (using Process.Start) the GUI...
4
8794
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Following the samples online, we implemented a windows service in .Net. Like most services, there's a worker thread actually doing stuff in the background. The problem we've run into is...
15
7044
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
28
7336
by: | last post by:
I have a multi threaded windows form application that runs great after calling Application.Run(). Application.Run is required for a COM component I a using in the app (required for message loop). ...
7
2225
by: TheDude5B | last post by:
Hi, I have just installed Visual Studio 2005 on my windows Vista machine, and everything seems to work well after installing the service pack and then the vista upgrades. However, when I try...
9
2312
by: dm3281 | last post by:
Hello -- I plan on writing a C# service using VS2005. If I want my service to have a tray icon, is this typically done from within my service or do/should I create a controller application and...
7
4091
by: GaryDean | last post by:
(this was also posted on the MSDN WCF forum but the answers over there are not so good) I have a WCF Library hosted by IIS 6 and it all works fine. However I need to step through the code in the...
0
7224
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
7120
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
7323
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
7380
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...
1
5050
isladogs
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...
0
4706
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...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.