Skip to content

Commit

Permalink
Restoring post that has some GA hits
Browse files Browse the repository at this point in the history
  • Loading branch information
Jef Claes committed May 11, 2020
1 parent 2267a82 commit 884c40c
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 23 deletions.
169 changes: 169 additions & 0 deletions cannot-start-service-from-command-line.html
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&#43;01:00" />
<meta itemprop="dateModified" content="2010-03-13T16:36:00&#43;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&rsquo;t debug your <code>OnStop</code>
event but this hasn&rsquo;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>
11 changes: 11 additions & 0 deletions feeds/posts/default
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,17 @@ System.Func&amp;lt;Exception, Boolean&amp;gt; predicate The predicate to execute
Roadtrippin&amp;rsquo; Minutes after leaving home we discovered an unpleasant surprise; my Tom Tom has no map of the Czech Republic. Good thing that people used to print this stuff on paper. After consulting a paper map of Europe we did have an idea which direction to follow.</description>
</item>

<item>
<title>Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</title>
<link>https://jefclaes.be/cannot-start-service-from-command-line.html</link>
<pubDate>Sat, 13 Mar 2010 16:36:00 +0100</pubDate>

<guid>https://jefclaes.be/cannot-start-service-from-command-line.html</guid>
<description>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.</description>
</item>

<item>
<title>Book review: Object-Oriented JavaScript</title>
<link>https://jefclaes.be/2010/02/book-review-object-oriented-javascript.html</link>
Expand Down
44 changes: 22 additions & 22 deletions page/23/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,28 @@ <h4 class="title small">
</div>
</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">
<h4 class="title small">
<a href="/cannot-start-service-from-command-line.html">Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</a>
</h4>
<span class="description">

When you create a new Windows Service project and try to debug it,
Visual Studio will show you a Windows Service Start F...

</span>
</div>
</div>
</div>

<div class="post">
<div class="post-header">
<div class="meta">
Expand Down Expand Up @@ -264,28 +286,6 @@ <h4 class="title small">
</div>
</div>

<div class="post">
<div class="post-header">
<div class="meta">
<div class="date">
<span class="day">17</span>
<span class="rest">Nov 2009</span>
</div>
</div>
<div class="matter">
<h4 class="title small">
<a href="/2009/11/book-review-professional-refactoring-in.html">Book review: Professional Refactoring in C# &amp; ASP.NET</a>
</h4>
<span class="description">

Three months ago I was looking up to refactoring a legacy ASP.NET
Webforms application. Although I was familiar with ref...

</span>
</div>
</div>
</div>



<ul class="pagination">
Expand Down
22 changes: 22 additions & 0 deletions page/24/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,28 @@ <h1 class="site-title"><a href="https://jefclaes.be/">Jef Claes</a></h1>



<div class="post">
<div class="post-header">
<div class="meta">
<div class="date">
<span class="day">17</span>
<span class="rest">Nov 2009</span>
</div>
</div>
<div class="matter">
<h4 class="title small">
<a href="/2009/11/book-review-professional-refactoring-in.html">Book review: Professional Refactoring in C# &amp; ASP.NET</a>
</h4>
<span class="description">

Three months ago I was looking up to refactoring a legacy ASP.NET
Webforms application. Although I was familiar with ref...

</span>
</div>
</div>
</div>

<div class="post">
<div class="post-header">
<div class="meta">
Expand Down
11 changes: 11 additions & 0 deletions post/feeds/posts/default
Original file line number Diff line number Diff line change
Expand Up @@ -2269,6 +2269,17 @@ System.Func&amp;lt;Exception, Boolean&amp;gt; predicate The predicate to execute
Roadtrippin&amp;rsquo; Minutes after leaving home we discovered an unpleasant surprise; my Tom Tom has no map of the Czech Republic. Good thing that people used to print this stuff on paper. After consulting a paper map of Europe we did have an idea which direction to follow.</description>
</item>

<item>
<title>Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</title>
<link>https://jefclaes.be/cannot-start-service-from-command-line.html</link>
<pubDate>Sat, 13 Mar 2010 16:36:00 +0100</pubDate>

<guid>https://jefclaes.be/cannot-start-service-from-command-line.html</guid>
<description>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.</description>
</item>

<item>
<title>Book review: Object-Oriented JavaScript</title>
<link>https://jefclaes.be/2010/02/book-review-object-oriented-javascript.html</link>
Expand Down
20 changes: 20 additions & 0 deletions post/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4578,6 +4578,26 @@ <h4 class="title small">
</div>
</div>
</li><li 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">
<h4 class="title small">
<a href="/cannot-start-service-from-command-line.html">Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</a>
</h4>
<span class="description">

When you create a new Windows Service project and try to debug it,
Visual Studio will show you a Windows Service Start F...

</span>
</div>
</div>
</li><li class="post">
<div class="post-header">
<div class="meta">
<div class="date">
Expand Down
5 changes: 5 additions & 0 deletions sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,11 @@
<lastmod>2010-04-12T20:16:00+02:00</lastmod>
</url>

<url>
<loc>https://jefclaes.be/cannot-start-service-from-command-line.html</loc>
<lastmod>2010-03-13T16:36:00+01:00</lastmod>
</url>

<url>
<loc>https://jefclaes.be/2010/02/book-review-object-oriented-javascript.html</loc>
<lastmod>2010-02-22T19:47:00+01:00</lastmod>
Expand Down
11 changes: 11 additions & 0 deletions tags/code/feeds/posts/default
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,17 @@ System.Func&amp;lt;Exception, Boolean&amp;gt; predicate The predicate to execute
<description>Doing batch operations and elegantly handling exceptions is a problem which every developer has faced before. In .NET 3.5 or older there is no out-of-the-box solution to handle exceptions in these types of scenarios, without being inconsistent to the normal flow of exception handling. .NET 4 introduces the AggregateException; an exception representing multiple exceptions. The AggregateException was introduced in the first place to be used with the parallel framework, but it can be used in other scenarios as well, such as batch operations.</description>
</item>

<item>
<title>Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</title>
<link>https://jefclaes.be/cannot-start-service-from-command-line.html</link>
<pubDate>Sat, 13 Mar 2010 16:36:00 +0100</pubDate>

<guid>https://jefclaes.be/cannot-start-service-from-command-line.html</guid>
<description>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.</description>
</item>

<item>
<title>Webforms lessons learned the hard way (Part 2)</title>
<link>https://jefclaes.be/2010/02/webforms-lessons-learned-hard-way-part_15.html</link>
Expand Down
20 changes: 20 additions & 0 deletions tags/code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,26 @@ <h4 class="title small">
</div>
</div>
</li><li 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">
<h4 class="title small">
<a href="/cannot-start-service-from-command-line.html">Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..</a>
</h4>
<span class="description">

When you create a new Windows Service project and try to debug it,
Visual Studio will show you a Windows Service Start F...

</span>
</div>
</div>
</li><li class="post">
<div class="post-header">
<div class="meta">
<div class="date">
Expand Down
2 changes: 1 addition & 1 deletion tags/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h1 class="page-title">Tags</h1>



<a style="font-size: 1rem;" href="https://jefclaes.be/tags/code/">code<sup>94</sup></a>
<a style="font-size: 1rem;" href="https://jefclaes.be/tags/code/">code<sup>95</sup></a>



Expand Down

0 comments on commit 884c40c

Please sign in to comment.