tag:blogger.com,1999:blog-33753991.post7955725906393794872..comments2023-09-01T06:00:23.693-07:00Comments on Geek Goddess: Easy Windows ServicesBonniehttp://www.blogger.com/profile/11241425687786973525noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-33753991.post-48507222306561872702018-04-18T02:16:37.450-07:002018-04-18T02:16:37.450-07:00This comment has been removed by the author.ብርዒ ቀለምhttps://www.blogger.com/profile/15350499336832817433noreply@blogger.comtag:blogger.com,1999:blog-33753991.post-72295864339907709832015-07-11T01:01:42.931-07:002015-07-11T01:01:42.931-07:00When you elevate a batch file, it's working di...When you elevate a batch file, it's working directory changes to something different then it's position. That will naturally disrupts all the relative paths, causing all kinds of havok.<br /><br />The most solid solution is to preface all the relative paths with "%~dp0\". This is a batch variable for "batchfiles drive and path".<br /><br />You can just put in one for a change directory at the top, but that might not work if your batch resides on a network file (as then drive then reads "//[network share name])"Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-33753991.post-20708807214959678382014-04-25T08:29:08.352-07:002014-04-25T08:29:08.352-07:00What OS are you running on? I've not had a pro...What OS are you running on? I've not had a problem installing a service on XP, Win 7 and 2008R2 server. But I am usually logged onto my machines with Administrator rights ... I don't know if that's got anything to do with it or not. I've not tried to run the batch files "as administrator", but I wouldn't think that would cause it to look for your EXE in the system32 folder, that's really strange!Bonniehttps://www.blogger.com/profile/11241425687786973525noreply@blogger.comtag:blogger.com,1999:blog-33753991.post-30984695923250211702014-04-25T00:46:23.199-07:002014-04-25T00:46:23.199-07:00hi bonnie. if did all that you showed from the ins...hi bonnie. if did all that you showed from the install section for my windows service. if i run the bat file i get the following error:<br /><br />An exception occurred during the Install phase.<br />System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.<br /><br /><br />after some googling i found i need elevated privilages in order to run it. i tried running the bat file "as administrator", then it gives me the following error:<br /><br />Exception occurred while initializing the installation:System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Windows\system32\NoTwitFace.exe' or one of its dependencies. The system cannot find the file specified..<br /><br />i notice that it is now trying to find my exe in windows\system32.<br />i went back and tried the bat file with out admin rights it selects the correct source but doesnt have the security requirements to run installutil.<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-33753991.post-36635767603105398972013-12-15T21:57:23.621-08:002013-12-15T21:57:23.621-08:00Thanks edd, I'm glad you like my approach.
I&...Thanks edd, I'm glad you like my approach.<br /><br />I'm curious about your suggestion about ManagedInstallerClass.InstallHelper. I've searched a bit for examples and it seems like this would be used instead of a batch file? Is that correct? In my existing examples that I posted, where would you use the ManagedInstallerClass.InstallHelper?<br /><br />If this takes the place of my batch file, does it still call installutil.exe to do the dirty work?Bonniehttps://www.blogger.com/profile/11241425687786973525noreply@blogger.comtag:blogger.com,1999:blog-33753991.post-60278600158784466482013-12-15T11:30:00.643-08:002013-12-15T11:30:00.643-08:00This is actually a very neat approach. What I per...This is actually a very neat approach. What I personally like doing is modifying MSBuild to stop the service if it exists, and to install it if it is not already there, and finally restarting it at the end of a build.<br /><br />I do prefer your approach though as it avoids the need to 'attach debugger' :)<br /><br />I could suggest taking it yet a step further. If you modify it to accept command line arguments, you can use ManagedInstallerClass.InstallHelper to install the service via the command line.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-33753991.post-73817488433937531562013-10-25T08:16:51.558-07:002013-10-25T08:16:51.558-07:00Hi Pete! Thanks for your comments ... yes, the com...Hi Pete! Thanks for your comments ... yes, the command prompt start/stop is much quicker. Bonniehttps://www.blogger.com/profile/11241425687786973525noreply@blogger.comtag:blogger.com,1999:blog-33753991.post-44927884445083355692013-10-25T02:49:37.158-07:002013-10-25T02:49:37.158-07:00Hi Bonnie, nice article - one thing I've found...Hi Bonnie, nice article - one thing I've found useful when testing services is the ability to stop and start your service quickly without going into the control panel applets, this can be achieved by typing this at a command prompt ( I'm sure you know but others might not )<br /><br />NET START yourservice<br />NET STOP yourservice<br />pkfoxhttps://www.blogger.com/profile/09810246649090250522noreply@blogger.com