I am unable to install my windows service and the installutil is throwing the following error:
Running a transacted installation.
Beginning the Install phase of the installation.
See the contents of the log file for the d:\practice in .net\mywindowsservice\mywindowsservice\mywindowsse rvice\bin\practiceservice.exe assembly's progress.
The file is located at d:\practice in .net\mywindowsservice\mywindowsservice\mywindowsse rvice\bin\practiceservice.InstallLog.
An exception occurred during the Install phase.
System.InvalidOperationException: Unable to create an instance of the MyWindowsService.ServiceInstall installer type.
The inner exception System.Reflection.TargetInvocationException was thrown with the following error message: Exception has been thrown by the target of an invocation..
The inner exception System.NullReferenceException was thrown with the following error message: Object reference not set to an instance of an object..
The Rollback phase of the installation is beginning.
See the contents of the log file for the d:\practice in .net\mywindowsservice\mywindowsservice\mywindowsse rvice\bin\practiceservice.exe assembly's progress.
The file is located at d:\practice in .net\mywindowsservice\mywindowsservice\mywindowsse rvice\bin\practiceservice.InstallLog.
An exception occurred during the Rollback phase of the System.Configuration.Install.AssemblyInstaller installer.
System.InvalidOperationException: Unable to create an instance of the MyWindowsService.ServiceInstall installer type.
The inner exception System.Reflection.TargetInvocationException was thrown with the following error message: Exception has been thrown by the target of an invocation..
The inner exception System.NullReferenceException was thrown with the following error message: Object reference not set to an instance of an object..
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.
The Rollback phase completed successfully.
The transacted install has completed.
"ServiceInstall" is the class prepared to install the service in my project.
I dont know what is the process .NET uses for instatiating this class for installation but the Visual Studio's auto generated code, automatically created an instance by Mybase.New(), then how this it is not being instantiated.
I dont know where to strike.
Please help me out.
Attaching the code snippet which i used to prepare the installer:
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container
components = Nothing
InstallerService = New System.ServiceProcess.ServiceProcessInstaller
InstallerForService = New System.ServiceProcess.ServiceInstaller
Try
ErrorLogger = New ErrorLogging
InstallerService.Account = ServiceAccount.LocalSystem
InstallerService.Username = Nothing
InstallerService.Password = Nothing
'InstallerService.Context.LogMessage("Service being installed in machine" + System.Environment.MachineName())
InstallerForService.StartType = ServiceStartMode.Automatic
InstallerForService.ServiceName = "PracticeService"
InstallerForService.DisplayName = "Practice Service"
'InstallerCollect.Add(InstallerService)
'InstallerCollect.Add(InstallerForService)
Me.Installers.AddRange(New System.Configuration.Install.Installer() {Me.InstallerService, Me.InstallerForService})
ErrorLogger.LogErrorData("PracticeService", "Service being installed in machine" + System.Environment.MachineName())
Catch ex As Exception
ErrorLogger.LogErrorData("Installation", ex.Message)
End Try
End Sub
Thanks
Ashish Jain