Solved

Windows Service Error 1083

Posted on 2014-02-26
2
493 Views
Last Modified: 2014-02-26
Hi Experts

I am being tasked with building an automatic CSV writer to pull information from a database and write to CSV file.

I have created a Windows Service, and installer however, when i go to run the Service is fails with the error


Windows could not start the CSV Writer - Neo to TwoFour service on local computer
error 1083:
the executable program that this service is configured to run does not implement the service.

service
Imports System
Imports System.Timers
Imports System.ServiceProcess
Imports System.IO
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Text
Imports System.Configuration

Public Class Service1
    Inherits ServiceBase
    Private serviceTimer As Timer

    Dim sqlconn As New SqlConnection
    Dim connstr As String
    Dim sqldr As SqlDataReader
    Dim sqlstr As String
    Dim Frequency As Integer = 10000


    Public Sub New()
        ServiceName = "wsCSVWriter"
        CanStop = True
        CanPauseAndContinue = True
        CanHandleSessionChangeEvent = True
        AutoLog = True


        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub WriteLogEntry(ByVal sender As Object, ByVal e As ElapsedEventArgs)

        serviceTimer.Stop()
        EventLog.WriteEntry("CSVWriter Service active : " & e.SignalTime)
        ' Restart the timer.
        serviceTimer.Start()
    End Sub

    Protected Overrides Sub OnStart(ByVal args() As String)
        ' Obtain the interval between log entry writes from the first
        ' argument. Use 5000 milliseconds by default and enforce a 1000
        ' millisecond minimum.
        Dim interval As Double
        Try
            interval = Double.Parse(args(0))
            interval = Math.Max(1000, interval)
        Catch ex As Exception
            interval = 5000
        End Try
        EventLog.WriteEntry(String.Format("CSVWriter Service starting. Writing log entries every {0} milliseconds...", interval))
        ' Create, configure and start a System.Timers.Timer to
        ' periodically call the WriteLogEntry method. The Start
        ' and Stop methods of the System.Timers.Timer class
        ' make starting, pausing, resuming, and stopping the
        ' service straightforward.
        serviceTimer = New Timer
        serviceTimer.Interval = interval
        serviceTimer.AutoReset = True
        AddHandler serviceTimer.Elapsed, AddressOf WriteLogEntry
        serviceTimer.Start()




    End Sub

    Protected Overrides Sub OnStop()
        EventLog.WriteEntry("CSVWriter Service stopping...")
        serviceTimer.Stop()
    End Sub

End Class

Open in new window


project installer

Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.ServiceProcess

Public Class ProjectInstaller
    Inherits Installer



    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

        'Add initialization code after the call to InitializeComponent
        Dim ServiceExampleProcess As New ServiceProcessInstaller
        ServiceExampleProcess.Account = ServiceAccount.LocalSystem
        ' Instantiate and configure a ServiceInstaller.
        Dim ServiceExampleInstaller As New ServiceInstaller
        ServiceExampleInstaller.DisplayName = "CSV Writer - Neo to TwoFour"
        ServiceExampleInstaller.ServiceName = "wsCSVWriter.exe"
        ServiceExampleInstaller.StartType = ServiceStartMode.Automatic
        Installers.Add(ServiceExampleInstaller)
        Installers.Add(ServiceExampleProcess)

    End Sub

    Private Sub ServiceInstaller1_AfterInstall(sender As Object, e As InstallEventArgs) Handles ServiceInstaller1.AfterInstall

    End Sub
End Class

Open in new window


any and all help appreciated
0
Comment
Question by:SimonPrice33
2 Comments
 
LVL 11

Accepted Solution

by:
Mihai Stancescu earned 500 total points
ID: 39891104
Hi,

Change this line in the installer class:
ServiceExampleInstaller.ServiceName = "wsCSVWriter.exe"

Open in new window

to this:
ServiceExampleInstaller.ServiceName = "wsCSVWriter"

Open in new window


You have set different service name in the service class and installer class.

Regards,
Mishu
0
 

Author Closing Comment

by:SimonPrice33
ID: 39891137
thank you, I have resolved the issue now :)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now