Service does not start after an upgrade to version 3.1.2 - System.IO.IOException

2,008 views
Skip to first unread message

Remy Burney

unread,
Nov 19, 2013, 12:30:03 AM11/19/13
to topshelf...@googlegroups.com
Hello,

I had a project running with the version 3.1.1 of Topshelf and I updated the version to the new one, the version 3.1.2.
Now when I try to test the service in Visual Studio, the service does not start at all.
There is no call to the Start function in the service, and the exitCode is Topshelf.TopshelfExitCode.AbnormalExit

I can see an Exception raised in the Console :

Topshelf.Hosts.ConsoleRunHost Error: 0 : An exception occurred, System.IO.IOException: The operation completed successfully.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.__Error.WinIOError()
   at System.Console.set_Title(String value)
   at Topshelf.Hosts.ConsoleRunHost.Run()

Below is the code I'm running :

static class Program
    {
        static void Main()
        {
            TopshelfExitCode exitCode = HostFactory.Run(x =>
            {
                x.Service<MyService>();
                
                x.SetDescription("My service");
                x.SetDisplayName("MyService");
                x.SetServiceName("MyService");

            });

        }
    }

Is there something I'm doing wrong ?

Thanks for your help.

Chris Patterson

unread,
Nov 19, 2013, 1:51:45 AM11/19/13
to topshelf...@googlegroups.com
I just verified that it is working as expected, both from a console (admin or regular user) and using F5 in Visual Studio targeting .NET 4.0 on the build.

What OS are you using (I'm on Windows 2008 R2 Server).



--
You received this message because you are subscribed to the Google Groups "topshelf-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topshelf-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Remy Burney

unread,
Nov 25, 2013, 5:55:52 PM11/25/13
to topshelf...@googlegroups.com

I found my issue, it was related to the "Output Type" in the project configuration.
There are 3 choices in that drop down list : "Windows Application", "Console Application", and "Class Library".

If you don't select "Console Application", the service will not start. The reason for that is because you cannot set the Console Name if it's not a console application.
It may be easy to understand when you see it like that, but the errors were not very clear and easy to debug in Visual Studio.

So if you have the same issue, please make sure you select the output type "Console Application" on your project.
Reply all
Reply to author
Forward
0 new messages