<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Windows Services in C#: Debugging Windows Services (part 4)</title>
	<atom:link href="http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/</link>
	<description>Making Microsoft .Net Development Magical</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:57:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Mark</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-29174</link>
		<dc:creator><![CDATA[Mark]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 00:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-29174</guid>
		<description><![CDATA[Here&#039;s my tip for debugging a service:  Comment out the existing Main() function in Program.cs.  Replace it with a command line style Main(string[] args) function.  Into this new function, copy the contents of your OnStart() function (From Service.cs).  Then add this line:

System.Threading.Thread.CurrentThread.Join();

Now you can run the service right from inside Visual Studio.  Press the &quot;play&quot; button.  That thread join line will cause your debug session to run forever.  Click the stop button to stop it.

Of course you can&#039;t debug through your Service.cs file because you just bypassed it, but everything outside there is fair game for breakpoints.]]></description>
		<content:encoded><![CDATA[<p>Here&#8217;s my tip for debugging a service:  Comment out the existing Main() function in Program.cs.  Replace it with a command line style Main(string[] args) function.  Into this new function, copy the contents of your OnStart() function (From Service.cs).  Then add this line:</p>
<p>System.Threading.Thread.CurrentThread.Join();</p>
<p>Now you can run the service right from inside Visual Studio.  Press the &#8220;play&#8221; button.  That thread join line will cause your debug session to run forever.  Click the stop button to stop it.</p>
<p>Of course you can&#8217;t debug through your Service.cs file because you just bypassed it, but everything outside there is fair game for breakpoints.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-28796</link>
		<dc:creator><![CDATA[Ashish]]></dc:creator>
		<pubDate>Thu, 06 Jan 2011 11:25:01 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-28796</guid>
		<description><![CDATA[I use window service it work well with database and webservice.asmx but this cant send sms . This window sevice can send sms only in debug mode. Somebody have solution?]]></description>
		<content:encoded><![CDATA[<p>I use window service it work well with database and webservice.asmx but this cant send sms . This window sevice can send sms only in debug mode. Somebody have solution?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Susan</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-27746</link>
		<dc:creator><![CDATA[Susan]]></dc:creator>
		<pubDate>Thu, 06 May 2010 07:30:05 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-27746</guid>
		<description><![CDATA[I got this help from microsoft support. But yours is a detailed one. Thanks in Advance.]]></description>
		<content:encoded><![CDATA[<p>I got this help from microsoft support. But yours is a detailed one. Thanks in Advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fahad</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-27365</link>
		<dc:creator><![CDATA[Fahad]]></dc:creator>
		<pubDate>Mon, 21 Dec 2009 15:33:48 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-27365</guid>
		<description><![CDATA[hit there 

a bit sort of same problem as discuses above near by above user&#039;s .
The Thing is .
the service and all its ingredients a re installed .
Using vista i have already disable UAC.
using vs 2005 C#.
i step in in to the debug mode but eventually when trying to step in or f10,f11 .
i can able to step in into few lines of my code successfully but at some stage when i tried to stepped in for more lines  my  Vs 2005 goes out of the debug mode .

so can any 1 help me in this or any suggestions. 

Regards 

And Thnx In Advance]]></description>
		<content:encoded><![CDATA[<p>hit there </p>
<p>a bit sort of same problem as discuses above near by above user&#8217;s .<br />
The Thing is .<br />
the service and all its ingredients a re installed .<br />
Using vista i have already disable UAC.<br />
using vs 2005 C#.<br />
i step in in to the debug mode but eventually when trying to step in or f10,f11 .<br />
i can able to step in into few lines of my code successfully but at some stage when i tried to stepped in for more lines  my  Vs 2005 goes out of the debug mode .</p>
<p>so can any 1 help me in this or any suggestions. </p>
<p>Regards </p>
<p>And Thnx In Advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-26676</link>
		<dc:creator><![CDATA[Mark]]></dc:creator>
		<pubDate>Fri, 01 May 2009 17:16:15 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-26676</guid>
		<description><![CDATA[hi, nice article... i have a problem... i have  a service running, but when try attaching to it, i get an error that a debugger is already assigned.... some one might have attached a debugger to it...but how do i continue with it... thanxx]]></description>
		<content:encoded><![CDATA[<p>hi, nice article&#8230; i have a problem&#8230; i have  a service running, but when try attaching to it, i get an error that a debugger is already assigned&#8230;. some one might have attached a debugger to it&#8230;but how do i continue with it&#8230; thanxx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Florian</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-26550</link>
		<dc:creator><![CDATA[Florian]]></dc:creator>
		<pubDate>Fri, 20 Mar 2009 21:25:16 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-26550</guid>
		<description><![CDATA[Thank you for your great howto - I appreciate it.

My experience is that there is no need to uninstall and install again to make some changes.

Just if you change the name of the service you should prior uninstall. If this is forgotten use the sc tool.

Cheers.]]></description>
		<content:encoded><![CDATA[<p>Thank you for your great howto &#8211; I appreciate it.</p>
<p>My experience is that there is no need to uninstall and install again to make some changes.</p>
<p>Just if you change the name of the service you should prior uninstall. If this is forgotten use the sc tool.</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cian</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25928</link>
		<dc:creator><![CDATA[Cian]]></dc:creator>
		<pubDate>Wed, 24 Sep 2008 01:26:52 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25928</guid>
		<description><![CDATA[You could put a Sleep for 10 minutes at the start of your OnStart. Then put a break point on the next line. 

Now all you need to do is Restart the service and attach before ten minutes runs out.

hackalicious I know!]]></description>
		<content:encoded><![CDATA[<p>You could put a Sleep for 10 minutes at the start of your OnStart. Then put a break point on the next line. </p>
<p>Now all you need to do is Restart the service and attach before ten minutes runs out.</p>
<p>hackalicious I know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25879</link>
		<dc:creator><![CDATA[Eric]]></dc:creator>
		<pubDate>Tue, 09 Sep 2008 18:11:13 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25879</guid>
		<description><![CDATA[I have the exact same problem as ruben ...
I&#039;ve done all the stuff and attached properly to the service-process successfully and Visual Studio enters debug mode but it never breaks at any of my breakpoints, I&#039;ve tried restarting the service and then re-attaching to the process but no luck:
VS2005 never enters the breakpoints ! :-(

Any ideas would be appriciated ... I&#039;ve created dosens of breakpoints all over the service but no luck!]]></description>
		<content:encoded><![CDATA[<p>I have the exact same problem as ruben &#8230;<br />
I&#8217;ve done all the stuff and attached properly to the service-process successfully and Visual Studio enters debug mode but it never breaks at any of my breakpoints, I&#8217;ve tried restarting the service and then re-attaching to the process but no luck:<br />
VS2005 never enters the breakpoints ! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>Any ideas would be appriciated &#8230; I&#8217;ve created dosens of breakpoints all over the service but no luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeteM</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25806</link>
		<dc:creator><![CDATA[PeteM]]></dc:creator>
		<pubDate>Thu, 14 Aug 2008 13:55:12 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25806</guid>
		<description><![CDATA[Ruben, this post explains how you can do it:
http://weblogs.asp.net/paulballard/archive/2005/07/12/419175.aspx

// The main entry point for the process
static void Main()
{
#if DEBUG
      System.Diagnostics.Debugger.Launch();
#endif   ...

Also, this post takes it a bit further:
http://theimes.com/archive/2006/12/28/Debugging-Windows-Services-is-a-Pain.aspx]]></description>
		<content:encoded><![CDATA[<p>Ruben, this post explains how you can do it:<br />
<a href="http://weblogs.asp.net/paulballard/archive/2005/07/12/419175.aspx" rel="nofollow">http://weblogs.asp.net/paulballard/archive/2005/07/12/419175.aspx</a></p>
<p>// The main entry point for the process<br />
static void Main()<br />
{<br />
#if DEBUG<br />
      System.Diagnostics.Debugger.Launch();<br />
#endif   &#8230;</p>
<p>Also, this post takes it a bit further:<br />
<a href="http://theimes.com/archive/2006/12/28/Debugging-Windows-Services-is-a-Pain.aspx" rel="nofollow">http://theimes.com/archive/2006/12/28/Debugging-Windows-Services-is-a-Pain.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ruben</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25733</link>
		<dc:creator><![CDATA[ruben]]></dc:creator>
		<pubDate>Tue, 22 Jul 2008 19:37:07 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25733</guid>
		<description><![CDATA[How do you debug the OnStart() Event?  If your process has to be already running then it&#039;ll never hit that event.]]></description>
		<content:encoded><![CDATA[<p>How do you debug the OnStart() Event?  If your process has to be already running then it&#8217;ll never hit that event.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Baughman</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25114</link>
		<dc:creator><![CDATA[John Baughman]]></dc:creator>
		<pubDate>Mon, 28 Apr 2008 21:28:17 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-25114</guid>
		<description><![CDATA[Another option to the installutil utility, you can add auto install code and at a command prompt install and uninstall your service by running it with a simple parameter. The attach to process part is still the same. I can send you a sample project of how I did it so you could update if you like the idea. It&#039;s a little quicker to run.

The only drawback to debugging services is that you can&#039;t easily debug a self starting service, and backing out of that code kind of hurts the ego... ;)

Great stuff here though! Thanks!]]></description>
		<content:encoded><![CDATA[<p>Another option to the installutil utility, you can add auto install code and at a command prompt install and uninstall your service by running it with a simple parameter. The attach to process part is still the same. I can send you a sample project of how I did it so you could update if you like the idea. It&#8217;s a little quicker to run.</p>
<p>The only drawback to debugging services is that you can&#8217;t easily debug a self starting service, and backing out of that code kind of hurts the ego&#8230; <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Great stuff here though! Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudeep Kaul</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12751</link>
		<dc:creator><![CDATA[Sudeep Kaul]]></dc:creator>
		<pubDate>Mon, 03 Sep 2007 10:13:46 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12751</guid>
		<description><![CDATA[Hey !!! Got the solution it was UAC. Thanks anyways.]]></description>
		<content:encoded><![CDATA[<p>Hey !!! Got the solution it was UAC. Thanks anyways.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudeep Kaul</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12750</link>
		<dc:creator><![CDATA[Sudeep Kaul]]></dc:creator>
		<pubDate>Mon, 03 Sep 2007 10:00:05 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12750</guid>
		<description><![CDATA[Sorry forgot to add - I am running it under &quot;Administrative&quot; privilages.]]></description>
		<content:encoded><![CDATA[<p>Sorry forgot to add &#8211; I am running it under &#8220;Administrative&#8221; privilages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sudeep Kaul</title>
		<link>http://arcanecode.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12749</link>
		<dc:creator><![CDATA[Sudeep Kaul]]></dc:creator>
		<pubDate>Mon, 03 Sep 2007 09:57:11 +0000</pubDate>
		<guid isPermaLink="false">http://arcanecode.wordpress.com/2007/05/24/windows-services-in-c-debugging-windows-services-part-4/#comment-12749</guid>
		<description><![CDATA[&quot;Unable to attch to the process. You do not have the permission to debug the process&quot; - This is what I am getting while trying to debug the project in Windows Vista Home Premium and .Net 3.0 . What should I do ?]]></description>
		<content:encoded><![CDATA[<p>&#8220;Unable to attch to the process. You do not have the permission to debug the process&#8221; &#8211; This is what I am getting while trying to debug the project in Windows Vista Home Premium and .Net 3.0 . What should I do ?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

