-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restoring post that has some GA hits
- Loading branch information
Jef Claes
committed
May 11, 2020
1 parent
2267a82
commit 884c40c
Showing
10 changed files
with
292 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe).. - Jef Claes</title><meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta itemprop="name" content="Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe).."> | ||
<meta itemprop="description" content="When you create a new Windows Service project and try to debug it, Visual Studio will show you a Windows Service Start Failure with the message Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe) and then started with the Server Explorer, Windows Services Administrative tool or the NET START command.. | ||
The trick my team and I use to workaround this problem, makes use of the service Debug flag."> | ||
<meta itemprop="datePublished" content="2010-03-13T16:36:00+01:00" /> | ||
<meta itemprop="dateModified" content="2010-03-13T16:36:00+01:00" /> | ||
<meta itemprop="wordCount" content="209"> | ||
|
||
|
||
|
||
<meta itemprop="keywords" content="code," /><meta property="og:title" content="Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe).." /> | ||
<meta property="og:description" content="When you create a new Windows Service project and try to debug it, Visual Studio will show you a Windows Service Start Failure with the message Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe) and then started with the Server Explorer, Windows Services Administrative tool or the NET START command.. | ||
The trick my team and I use to workaround this problem, makes use of the service Debug flag." /> | ||
<meta property="og:type" content="article" /> | ||
<meta property="og:url" content="https://jefclaes.be/cannot-start-service-from-command-line.html" /> | ||
<meta property="article:published_time" content="2010-03-13T16:36:00+01:00" /> | ||
<meta property="article:modified_time" content="2010-03-13T16:36:00+01:00" /> | ||
<meta name="twitter:card" content="summary"/> | ||
<meta name="twitter:title" content="Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe).."/> | ||
<meta name="twitter:description" content="When you create a new Windows Service project and try to debug it, Visual Studio will show you a Windows Service Start Failure with the message Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe) and then started with the Server Explorer, Windows Services Administrative tool or the NET START command.. | ||
The trick my team and I use to workaround this problem, makes use of the service Debug flag."/> | ||
<link href='https://fonts.googleapis.com/css?family=Playfair+Display:700' rel='stylesheet' type='text/css'> | ||
<link rel="stylesheet" type="text/css" media="screen" href="https://jefclaes.be/css/normalize.css" /> | ||
<link rel="stylesheet" type="text/css" media="screen" href="https://jefclaes.be/css/main.css" /> | ||
|
||
<link id="dark-scheme" rel="stylesheet" type="text/css" href="https://jefclaes.be/css/dark.css" /> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | ||
<script src="https://jefclaes.be/js/main.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="container wrapper"> | ||
<div class="header"> | ||
|
||
<div class="avatar"> | ||
<a href="https://jefclaes.be/"> | ||
<img src="https://image.freepik.com/free-vector/young-man-head-with-beard-avatar-character_24877-36786.jpg" alt="Jef Claes" /> | ||
</a> | ||
</div> | ||
|
||
<h1 class="site-title"><a href="https://jefclaes.be/">Jef Claes</a></h1> | ||
<div class="site-description"><p>On software and life</p><nav class="nav social"> | ||
<ul class="flat"><li><a href="https://github.com/jefclaes" title="Github"><i data-feather="github"></i></a></li><li><a href="https://twitter.com/jefclaes" title="Twitter"><i data-feather="twitter"></i></a></li><li><a href="https://www.linkedin.com/in/jefclaes" title="LinkedIn"><i data-feather="linkedin"></i></a></li><li><a href="http://feed.jefclaes.be" title="RSS"><i data-feather="rss"></i></a></li></ul> | ||
</nav></div> | ||
|
||
<nav class="nav"> | ||
<ul class="flat"> | ||
|
||
<li> | ||
<a href="/">Home</a> | ||
</li> | ||
|
||
<li> | ||
<a href="/post">All posts</a> | ||
</li> | ||
|
||
<li> | ||
<a href="/tags">Tags</a> | ||
</li> | ||
|
||
</ul> | ||
</nav> | ||
</div> | ||
|
||
|
||
<div class="post"> | ||
<div class="post-header"> | ||
|
||
<div class="meta"> | ||
<div class="date"> | ||
<span class="day">13</span> | ||
<span class="rest">Mar 2010</span> | ||
</div> | ||
</div> | ||
|
||
<div class="matter"> | ||
<h1 class="title">Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</h1> | ||
</div> | ||
</div> | ||
|
||
<div class="markdown"> | ||
<p>When you create a new Windows Service project and try to debug it, | ||
Visual Studio will show you a Windows Service Start Failure with the | ||
message <code>Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe) and then started with the Server Explorer, Windows Services Administrative tool or the NET START command.</code>.</p> | ||
<p><a href="/post/images/2010-03-13-cannot-start-service-from-the-command-line-or-debugger-a-windows-service-must-first-be-installed-using-installutil-exe-serviceError.JPG"><img src="/post/images/thumbnails/2010-03-13-cannot-start-service-from-the-command-line-or-debugger-a-windows-service-must-first-be-installed-using-installutil-exe-serviceError.JPG" alt=""></a><br> | ||
The trick my team and I use to workaround this problem, makes use of the | ||
service <code>Debug</code> flag. If the <code>Debug</code> flag is on, we just start the service | ||
by using our own public <code>Start</code> method. When the <code>OnStart</code> event is fired in | ||
the service itself, we call the same public <code>Start</code> method.</p> | ||
<p>This goes in your service.</p> | ||
<div class="highlight"><pre style="color:#586e75;background-color:#eee8d5;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-csharp" data-lang="csharp"><span style="color:#859900">protected</span> <span style="color:#859900">override</span> <span style="color:#859900">void</span> <span style="color:#268bd2">OnStart</span>(<span style="color:#859900;font-weight:bold">string</span>[] <span style="color:#268bd2">args</span>) | ||
{ | ||
<span style="color:#268bd2">Start</span>(); | ||
} | ||
|
||
<span style="color:#859900">public</span> <span style="color:#859900">void</span> <span style="color:#268bd2">Start</span>() | ||
{ | ||
<span style="color:#93a1a1;font-style:italic">//Start! | ||
</span><span style="color:#93a1a1;font-style:italic"></span>} | ||
</code></pre></div><p>And this goes in <code>Program.cs</code>.</p> | ||
<div class="highlight"><pre style="color:#586e75;background-color:#eee8d5;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-csharp" data-lang="csharp"><span style="color:#859900">namespace</span> <span style="color:#268bd2">UdpListener</span> | ||
{ | ||
<span style="color:#859900">static</span> <span style="color:#859900">class</span> <span style="color:#cb4b16">Program</span> | ||
{ | ||
<span style="color:#859900">static</span> <span style="color:#859900">void</span> <span style="color:#268bd2">Main</span>() | ||
{ | ||
<span style="color:#93a1a1;font-style:italic">#if (!DEBUG) | ||
</span><span style="color:#93a1a1;font-style:italic"></span> <span style="color:#268bd2">ServiceBase</span>[] <span style="color:#268bd2">ServicesToRun</span>; | ||
<span style="color:#268bd2">ServicesToRun</span> = <span style="color:#859900">new</span> <span style="color:#268bd2">ServiceBase</span>[] | ||
{ | ||
<span style="color:#859900">new</span> <span style="color:#268bd2">UdpListener</span>() | ||
}; | ||
|
||
<span style="color:#268bd2">ServiceBase</span>.<span style="color:#268bd2">Run</span>(<span style="color:#268bd2">ServicesToRun</span>); | ||
<span style="color:#93a1a1;font-style:italic">#else | ||
</span><span style="color:#93a1a1;font-style:italic"></span> <span style="color:#268bd2">UdpListener</span> <span style="color:#268bd2">listener</span> = <span style="color:#859900">new</span> <span style="color:#268bd2">UdpListener</span>(); | ||
|
||
<span style="color:#268bd2">listener</span>.<span style="color:#268bd2">Start</span>(); | ||
<span style="color:#93a1a1;font-style:italic">#endif | ||
</span><span style="color:#93a1a1;font-style:italic"></span> } | ||
} | ||
} | ||
</code></pre></div><p>You can set the <code>Debug</code> flag of your service in your service properties.</p> | ||
<p><a href="/post/images/2010-03-13-cannot-start-service-from-the-command-line-or-debugger-a-windows-service-must-first-be-installed-using-installutil-exe-debug.JPG"><img src="/post/images/thumbnails/2010-03-13-cannot-start-service-from-the-command-line-or-debugger-a-windows-service-must-first-be-installed-using-installutil-exe-debug.JPG" alt=""></a></p> | ||
<p>The only problem with this solution is that you can’t debug your <code>OnStop</code> | ||
event but this hasn’t been an issue for us so far.</p> | ||
|
||
</div> | ||
|
||
<div class="tags"> | ||
|
||
|
||
<ul class="flat"> | ||
|
||
<li><a href="/tags/code">code</a></li> | ||
|
||
</ul> | ||
|
||
|
||
</div></div> | ||
</div> | ||
<div class="footer wrapper"> | ||
<nav class="nav"> | ||
<div>2010 <a href="https://github.com/knadh/hugo-ink">Ink</a> theme on <a href="https://gohugo.io">Hugo</a></div> | ||
</nav> | ||
</div> | ||
|
||
|
||
<script type="application/javascript"> | ||
var doNotTrack = false; | ||
if (!doNotTrack) { | ||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; | ||
ga('create', 'UA-6239073-1', 'auto'); | ||
|
||
ga('send', 'pageview'); | ||
} | ||
</script> | ||
<script async src='https://www.google-analytics.com/analytics.js'></script> | ||
<script>feather.replace()</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters