<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Five ways debugging .NET Windows service</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx</link><description>Although debugging a Windows service is not so easy, especially you want to step into OnStart codes, there still exist a couple of techniques to get it done. I compiled them here in order to let Internet searchers get their work done as easy as possible.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Three ways debugging .NET Windows service</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx#2365958</link><pubDate>Wed, 02 May 2007 03:39:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2365958</guid><dc:creator>MichaelGiagnocavo</dc:creator><description>&lt;p&gt;What we do is something like #2. You can check Environment.UserInteractive. If it's running as a service, it won't be. We also don't compile as Console. We use Windows Application, but if its UserInteractive, then we call AllocConsole to open up a console window for debugging and other fun.&lt;/p&gt;
</description></item><item><title>re: Three ways debugging .NET Windows service</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx#2369782</link><pubDate>Wed, 02 May 2007 09:54:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2369782</guid><dc:creator>jackbond</dc:creator><description>&lt;p&gt;One approach I have found useful was to create an interface that duplicated the standard service events, ie:&lt;/p&gt;
&lt;p&gt;interface IServiceProcess&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Start();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Stop();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; Etc();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;In the actual service implementation, I loaded the classes that implemented IServiceProcess dynamically, and then started them in a loop. This way, I could selectively start and stop various service components either in the service process, or in a test app which could be debugged in Visual Studio. I originally did this for an emulator of a network enabled DVR, which required threads for managing an internal http server and for broadcasting/receiving UPNP messages. Each server process implemented IServiceProcess, and once development was complete on a particular component, I simply added it to the list of modules the service was to run.&lt;/p&gt;
</description></item><item><title>re: Five ways debugging .NET Windows service</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx#2377159</link><pubDate>Wed, 02 May 2007 20:26:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2377159</guid><dc:creator>yaleeyangmsblog</dc:creator><description>&lt;p&gt;Thanks for you guys' input. I already added you guys' techniques into the blog.&lt;/p&gt;
</description></item><item><title>How To Debug Windows Service OnStart</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx#8762939</link><pubDate>Tue, 22 Jul 2008 05:25:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8762939</guid><dc:creator>Notes from the Field</dc:creator><description>&lt;p&gt;The article, How to: Debug Windows Service Applications details how to attach to a running process to&lt;/p&gt;
</description></item><item><title>Debugging Windows Services</title><link>http://blogs.msdn.com/yaleeyangmsblog/archive/2007/05/02/three-ways-debugging-net-windows-service.aspx#9775769</link><pubDate>Thu, 18 Jun 2009 15:18:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9775769</guid><dc:creator>dotnet thoughts </dc:creator><description>&lt;p&gt;In the current project, I have to develop some windows services to sending out notification mails. The&lt;/p&gt;
</description></item></channel></rss>