{"id":3051,"date":"2004-08-08T09:26:00","date_gmt":"2004-08-07T23:26:00","guid":{"rendered":"http:\/\/new.radio-active.net.au\/web3\/programming-windows-services\/"},"modified":"2014-10-10T13:13:22","modified_gmt":"2014-10-10T02:13:22","slug":"programming-windows-services","status":"publish","type":"post","link":"http:\/\/www.radio-active.net.au\/web3\/3051","title":{"rendered":"Programming Windows Services"},"content":{"rendered":"<p>Last night I almost made a post with a big mistake. I was thinking about the X-Copy deply in VB.NET and realised that it did not work for Services. I know it does not &#8211; but not in that way. With ASP.NET you can overwrite the old copy of an exe even whilst it is running since ASP.NET takes a copy and places it in RAM or something until it is not needed. <\/p>\n<p>But with services they are kept on the disk. And they are locked. So you need to uninstall an old version before adding a new version.<\/p>\n<p>One of the other things that I want to do is to run a program either as a service or with a GUI depending on how the program started. After a lot of searching I found an article on the <a href=\"http:\/\/www.dotnet247.com\/247reference\/msgs\/39\/198629.aspx\">DotNet 247 Site<\/a>. Now this is a site I normally hate because they look like one of those horrible search engines that contaminate Google and never have the keywords when you go to the page. But this time I eventually found what I was looking for. <\/p>\n<p>One of the replies states<br \/>\n<br \/>  If the parameter is set, start as a service, if the parameter is not given,<br \/>\n<br \/>  start as a normal executable. Basically in your Sub Main, if the parameter<br \/>\n<br \/>  is given do the ServiceBase.Run else do Application.Run.<\/p>\n<p>Looks good, but being able to automatically determine it would be better. I am starting to &#8216;GET&#8217; services. Now that is worrying.<\/p>\n<h2>Music: Nothing. It is 8:24AM on a sunday morning&#8230; Argh<\/h2>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last night I almost made a post with a big mistake. I was thinking about the X-Copy deply in VB.NET and realised that it did not work for Services. I know it does not &#8211; but not in that way. &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"http:\/\/www.radio-active.net.au\/web3\/3051\"> <span class=\"screen-reader-text\">Programming Windows Services<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5cfmK-Nd","_links":{"self":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/3051"}],"collection":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/comments?post=3051"}],"version-history":[{"count":0,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/posts\/3051\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/media?parent=3051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/categories?post=3051"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.radio-active.net.au\/web3\/wp-json\/wp\/v2\/tags?post=3051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}