{"id":669,"date":"2012-11-26T12:30:49","date_gmt":"2012-11-26T10:30:49","guid":{"rendered":"http:\/\/www.dirkstrauss.com\/?p=669"},"modified":"2016-11-02T12:20:39","modified_gmt":"2016-11-02T12:20:39","slug":"debugging-windows-services","status":"publish","type":"post","link":"https:\/\/dirkstrauss.com\/debugging-windows-services\/","title":{"rendered":"Debugging Windows Services using an #if Directive"},"content":{"rendered":"<p style=\"text-align: justify;\">Debugging Windows Services &#8211;\u00a0I love writing them. In fact, to encompass a unit of functionality in a self contained bit of code is incredibly powerful.\u00a0That is, if it is written correctly. I think it is something we as programmers take a bit for granted. One thing I know, is that debugging a Windows Service is one of the most painful things ever. Give it a try&#8230; Create a Windows Service in Visual Studio (I&#8217;m using Visual Studio Ultimate 2012), start it in debug mode and take a gander at the error message you get.<\/p>\n<p style=\"text-align: justify;\"><!--more--><\/p>\n<h5 style=\"text-align: justify;\">Debugging Windows Services<\/h5>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Debug-Start-Failure-2.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Visual Studio 2012 Windows Service Debug Start Failure\" alt=\"Debugging Windows Services\" src=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Debug-Start-Failure-2.png\" width=\"489\" height=\"200\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">This week my colleague showed me an article he came across. The content of this article (Referenced at the end of this post)\u00a0made me very excited. If you are creating a Windows Service, there is a way to get rid of the whole install-with-installutil.exe method when you want to debug your code. To illustrate this method, fire up Visual Studio and create a Windows Service.<\/p>\n<p style=\"text-align: justify;\">Having a look in the Program.cs file, you will see the following code:<\/p>\n<p>[sourcecode language=&#8221;csharp&#8221;]<\/p>\n<p>static void Main()<br \/>\n{<br \/>\n   ServiceBase[] ServicesToRun;<br \/>\n   ServicesToRun = new ServiceBase[]<br \/>\n   {<br \/>\n      new Service1()<br \/>\n   };<br \/>\n   ServiceBase.Run(ServicesToRun);<br \/>\n}<\/p>\n<p>[\/sourcecode]<\/p>\n<p style=\"text-align: justify;\">Now, all that my dummy Windows Service does is check if SQL Server is running. In the Service1.cs file, I have added the following method:<\/p>\n<p>[sourcecode language=&#8221;csharp&#8221;]<br \/>\npublic string IsServiceRunning()<br \/>\n{<br \/>\n   string ServiceStatus = string.Empty;<br \/>\n   ServiceController sc = new ServiceController(&quot;MSSQL$SQLSERVER&quot;);<\/p>\n<p>   try<br \/>\n   {<br \/>\n      switch (sc.Status)<br \/>\n      {<br \/>\n         case ServiceControllerStatus.Running:<br \/>\n            return &quot;Running&quot;;<br \/>\n         case ServiceControllerStatus.Stopped:<br \/>\n            return &quot;Stopped&quot;;<br \/>\n         case ServiceControllerStatus.Paused:<br \/>\n            return &quot;Paused&quot;;<br \/>\n         case ServiceControllerStatus.StopPending:<br \/>\n            return &quot;Stopping&quot;;<br \/>\n         case ServiceControllerStatus.StartPending:<br \/>\n            return &quot;Starting&quot;;<br \/>\n         default:<br \/>\n            return &quot;Changing&quot;;<br \/>\n      }<br \/>\n   }<br \/>\n   catch(Exception ex)<br \/>\n   {<br \/>\n      ServiceStatus = &quot;error &#8211; &quot; + ex.Message;<br \/>\n   }<br \/>\n   return ServiceStatus;<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<p style=\"text-align: justify;\">The IsServiceRunning() method will usually be called from the OnStart() method of the service. But let&#8217;s say that the IsServiceRunning() method contains much more complex code that needs testing. You can test this method\u00a0immediately\u00a0without having to install the service first. Change your Program.cs file to look as follows:<\/p>\n<p>[sourcecode language=&#8221;csharp&#8221;]<br \/>\nstatic void Main()<br \/>\n{<br \/>\n  #if(!DEBUG)<br \/>\n   ServiceBase[] ServicesToRun;<br \/>\n   ServicesToRun = new ServiceBase[]<br \/>\n   {<br \/>\n      new Service1()<br \/>\n   };<br \/>\n   ServiceBase.Run(ServicesToRun);<br \/>\n  #else<br \/>\n   Service1 oService = new Service1();<br \/>\n   oService.IsServiceRunning();<br \/>\n  #endif<br \/>\n}<br \/>\n[\/sourcecode]<\/p>\n<p style=\"text-align: justify;\">The #if directive basically tells Visual Studio to run a different bit of code if we are debugging. Have a look at the screenshots below. If we select Start &#8211;&gt; Release, the code that will be executed is live and the code that will not run is greyed out.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Release-3.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Visual Studio 2012 Windows Service Release\" alt=\"Debugging Windows Services\" src=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Release-3.png\" width=\"323\" height=\"238\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Change to Start &#8211;&gt; Debug, and you will see that the code in the #else portion of the #if directive is now live, and the code after the #if is greyed out.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Debug-4.png\"><img loading=\"lazy\" decoding=\"async\" title=\"Visual Studio 2012 Windows Service Debug\" alt=\"Debugging Windows Services\" src=\"https:\/\/dirkstrauss.com\/wp-content\/uploads\/2012\/11\/Visual-Studio-2012-Windows-Service-Debug-4.png\" width=\"316\" height=\"230\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">You can now start your Windows Service in Debug Mode and step into your IsServiceRunning() method directly and test it to your hearts content. Now isn&#8217;t that the neatest thing you have ever seen?<\/p>\n<blockquote>\n<p style=\"text-align: justify;\">Original article by <a title=\"How to Debug or Test your Windows Service Without Installing it...\" href=\"http:\/\/www.codeproject.com\/Tips\/261190\/How-to-Debug-or-Test-your-Windows-Service-Without\" target=\"_blank\">Tejas Vaishnav<\/a><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Debugging Windows Services &#8211;\u00a0I love writing them. In fact, to encompass a unit of functionality in a self contained bit of code is incredibly powerful.\u00a0That is, if it is written correctly. I think it is something we as programmers take a bit for granted. One thing I know, is that debugging a Windows Service is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":680,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[70,12,71,72,18],"class_list":["post-669","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","tag-if-directive","tag-c","tag-debugging-windows-service","tag-installutil","tag-windows-service","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Debugging Windows Services using an #if Directive<\/title>\n<meta name=\"description\" content=\"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/dirkstrauss.com\/debugging-windows-services\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Debugging Windows Services using an #if Directive\" \/>\n<meta property=\"og:description\" content=\"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/dirkstrauss.com\/debugging-windows-services\/\" \/>\n<meta property=\"og:site_name\" content=\"Programming and Tech Blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-26T10:30:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-11-02T12:20:39+00:00\" \/>\n<meta name=\"author\" content=\"Dirk Strauss\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dirkstrauss\" \/>\n<meta name=\"twitter:site\" content=\"@dirkstrauss\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dirk Strauss\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/\"},\"author\":{\"name\":\"Dirk Strauss\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#\\\/schema\\\/person\\\/f1d2a7c16c5bda2f0c28031309fc53cd\"},\"headline\":\"Debugging Windows Services using an #if Directive\",\"datePublished\":\"2012-11-26T10:30:49+00:00\",\"dateModified\":\"2016-11-02T12:20:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/\"},\"wordCount\":507,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#\\\/schema\\\/person\\\/f1d2a7c16c5bda2f0c28031309fc53cd\"},\"image\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"keywords\":[\"#if directive\",\"C#\",\"debugging windows service\",\"installutil\",\"Windows Service\"],\"articleSection\":[\"Programming\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/\",\"url\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/\",\"name\":\"Debugging Windows Services using an #if Directive\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2012-11-26T10:30:49+00:00\",\"dateModified\":\"2016-11-02T12:20:39+00:00\",\"description\":\"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/debugging-windows-services\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dirkstrauss.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Debugging Windows Services using an #if Directive\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#website\",\"url\":\"https:\\\/\\\/dirkstrauss.com\\\/\",\"name\":\"Programming and Tech Blog\",\"description\":\"For the love of Technology\",\"publisher\":{\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#\\\/schema\\\/person\\\/f1d2a7c16c5bda2f0c28031309fc53cd\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/dirkstrauss.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/dirkstrauss.com\\\/#\\\/schema\\\/person\\\/f1d2a7c16c5bda2f0c28031309fc53cd\",\"name\":\"Dirk Strauss\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/i0.wp.com\\\/dirkstrauss.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/me.jpg?fit=200%2C200&ssl=1\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/dirkstrauss.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/me.jpg?fit=200%2C200&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/dirkstrauss.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/me.jpg?fit=200%2C200&ssl=1\",\"width\":200,\"height\":200,\"caption\":\"Dirk Strauss\"},\"logo\":{\"@id\":\"https:\\\/\\\/i0.wp.com\\\/dirkstrauss.com\\\/wp-content\\\/uploads\\\/2021\\\/04\\\/me.jpg?fit=200%2C200&ssl=1\"},\"description\":\"As a seasoned software developer with a long-standing career in C# and Visual Studio, I have had the privilege of working with a number of companies and learning from some of the most talented individuals in the industry. In addition to my professional experience, I have authored multiple books on topics such as C#, Visual Studio, and ASP.NET Core. My passion for programming is unwavering, and I am dedicated to staying current with the latest technology and sharing my expertise with others.\",\"sameAs\":[\"https:\\\/\\\/dirkstrauss.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/dirkstrauss\\\/\",\"https:\\\/\\\/x.com\\\/dirkstrauss\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Debugging Windows Services using an #if Directive","description":"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/dirkstrauss.com\/debugging-windows-services\/","og_locale":"en_US","og_type":"article","og_title":"Debugging Windows Services using an #if Directive","og_description":"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.","og_url":"https:\/\/dirkstrauss.com\/debugging-windows-services\/","og_site_name":"Programming and Tech Blog","article_published_time":"2012-11-26T10:30:49+00:00","article_modified_time":"2016-11-02T12:20:39+00:00","author":"Dirk Strauss","twitter_card":"summary_large_image","twitter_creator":"@dirkstrauss","twitter_site":"@dirkstrauss","twitter_misc":{"Written by":"Dirk Strauss","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#article","isPartOf":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/"},"author":{"name":"Dirk Strauss","@id":"https:\/\/dirkstrauss.com\/#\/schema\/person\/f1d2a7c16c5bda2f0c28031309fc53cd"},"headline":"Debugging Windows Services using an #if Directive","datePublished":"2012-11-26T10:30:49+00:00","dateModified":"2016-11-02T12:20:39+00:00","mainEntityOfPage":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/"},"wordCount":507,"commentCount":2,"publisher":{"@id":"https:\/\/dirkstrauss.com\/#\/schema\/person\/f1d2a7c16c5bda2f0c28031309fc53cd"},"image":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#primaryimage"},"thumbnailUrl":"","keywords":["#if directive","C#","debugging windows service","installutil","Windows Service"],"articleSection":["Programming"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/dirkstrauss.com\/debugging-windows-services\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/","url":"https:\/\/dirkstrauss.com\/debugging-windows-services\/","name":"Debugging Windows Services using an #if Directive","isPartOf":{"@id":"https:\/\/dirkstrauss.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#primaryimage"},"image":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#primaryimage"},"thumbnailUrl":"","datePublished":"2012-11-26T10:30:49+00:00","dateModified":"2016-11-02T12:20:39+00:00","description":"Debugging Windows Services in C# by using the #if Directive to run a different bit of code when debugging. What a great piece of code to use for debugging.","breadcrumb":{"@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/dirkstrauss.com\/debugging-windows-services\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/dirkstrauss.com\/debugging-windows-services\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/dirkstrauss.com\/"},{"@type":"ListItem","position":2,"name":"Debugging Windows Services using an #if Directive"}]},{"@type":"WebSite","@id":"https:\/\/dirkstrauss.com\/#website","url":"https:\/\/dirkstrauss.com\/","name":"Programming and Tech Blog","description":"For the love of Technology","publisher":{"@id":"https:\/\/dirkstrauss.com\/#\/schema\/person\/f1d2a7c16c5bda2f0c28031309fc53cd"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/dirkstrauss.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/dirkstrauss.com\/#\/schema\/person\/f1d2a7c16c5bda2f0c28031309fc53cd","name":"Dirk Strauss","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/i0.wp.com\/dirkstrauss.com\/wp-content\/uploads\/2021\/04\/me.jpg?fit=200%2C200&ssl=1","url":"https:\/\/i0.wp.com\/dirkstrauss.com\/wp-content\/uploads\/2021\/04\/me.jpg?fit=200%2C200&ssl=1","contentUrl":"https:\/\/i0.wp.com\/dirkstrauss.com\/wp-content\/uploads\/2021\/04\/me.jpg?fit=200%2C200&ssl=1","width":200,"height":200,"caption":"Dirk Strauss"},"logo":{"@id":"https:\/\/i0.wp.com\/dirkstrauss.com\/wp-content\/uploads\/2021\/04\/me.jpg?fit=200%2C200&ssl=1"},"description":"As a seasoned software developer with a long-standing career in C# and Visual Studio, I have had the privilege of working with a number of companies and learning from some of the most talented individuals in the industry. In addition to my professional experience, I have authored multiple books on topics such as C#, Visual Studio, and ASP.NET Core. My passion for programming is unwavering, and I am dedicated to staying current with the latest technology and sharing my expertise with others.","sameAs":["https:\/\/dirkstrauss.com","https:\/\/www.linkedin.com\/in\/dirkstrauss\/","https:\/\/x.com\/dirkstrauss"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1lNYm-aN","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/posts\/669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/comments?post=669"}],"version-history":[{"count":1,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/posts\/669\/revisions"}],"predecessor-version":[{"id":81669,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/posts\/669\/revisions\/81669"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dirkstrauss.com\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/media?parent=669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/categories?post=669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dirkstrauss.com\/wp-json\/wp\/v2\/tags?post=669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}