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\mywindowss ervice\mywindow sservice\mywind owsservice\bin\ practiceservice .exe assembly's progress.
The file is located at d:\practice in .net\mywindowss ervice\mywindow sservice\mywind owsservice\bin\ practiceservice .InstallLog.
An exception occurred during the Install phase.
System.InvalidO perationExcepti on: Unable to create an instance of the MyWindowsServic e.ServiceInstal l installer type.
The inner exception System.Reflecti on.TargetInvoca tionException was thrown with the following error message: Exception has been thrown by the target of an invocation..
The inner exception System.NullRefe renceException 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\mywindowss ervice\mywindow sservice\mywind owsservice\bin\ practiceservice .exe assembly's progress.
The file is located at d:\practice in .net\mywindowss ervice\mywindow sservice\mywind owsservice\bin\ practiceservice .InstallLog.
An exception occurred during the Rollback phase of the System.Configur ation.Install.A ssemblyInstalle r installer.
System.InvalidO perationExcepti on: Unable to create an instance of the MyWindowsServic e.ServiceInstal l installer type.
The inner exception System.Reflecti on.TargetInvoca tionException was thrown with the following error message: Exception has been thrown by the target of an invocation..
The inner exception System.NullRefe renceException 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.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
components = New System.Componen tModel.Containe r
components = Nothing
InstallerServic e = New System.ServiceP rocess.ServiceP rocessInstaller
InstallerForSer vice = New System.ServiceP rocess.ServiceI nstaller
Try
ErrorLogger = New ErrorLogging
InstallerServic e.Account = ServiceAccount. LocalSystem
InstallerServic e.Username = Nothing
InstallerServic e.Password = Nothing
'InstallerServi ce.Context.LogM essage("Service being installed in machine" + System.Environm ent.MachineName ())
InstallerForSer vice.StartType = ServiceStartMod e.Automatic
InstallerForSer vice.ServiceNam e = "PracticeServic e"
InstallerForSer vice.DisplayNam e = "Practice Service"
'InstallerColle ct.Add(Installe rService)
'InstallerColle ct.Add(Installe rForService)
Me.Installers.A ddRange(New System.Configur ation.Install.I nstaller() {Me.InstallerSe rvice, Me.InstallerFor Service})
ErrorLogger.Log ErrorData("Prac ticeService", "Service being installed in machine" + System.Environm ent.MachineName ())
Catch ex As Exception
ErrorLogger.Log ErrorData("Inst allation", ex.Message)
End Try
End Sub
Thanks
Ashish Jain