How to write a simple service
-
Hi Everyone, I have created a service with the help of dotnet framework and without the help of MSI(Installshield). I want to see my service(WindowsService_1) in Windows Service and using "installutil tools" (which Microsoft provided) which install my service in windows service but exception is raised "Exception occurred while initializing the installation: System.IO.FileNotFoundException: File or assembly name windowsservice_1.exe, or one of its dependencies, was not found.." So I am following each and everystep which is given on MSDN example and other site. I want to write a service without using MSI(Installshield). I go to command prompt(cmd) and write "InstallUtil windowsservice_1.exe". But is throwing an exception. I am giving full path of InstallUtil.exe. Can you help me out making a simple service. Thanks
-
Hi Everyone, I have created a service with the help of dotnet framework and without the help of MSI(Installshield). I want to see my service(WindowsService_1) in Windows Service and using "installutil tools" (which Microsoft provided) which install my service in windows service but exception is raised "Exception occurred while initializing the installation: System.IO.FileNotFoundException: File or assembly name windowsservice_1.exe, or one of its dependencies, was not found.." So I am following each and everystep which is given on MSDN example and other site. I want to write a service without using MSI(Installshield). I go to command prompt(cmd) and write "InstallUtil windowsservice_1.exe". But is throwing an exception. I am giving full path of InstallUtil.exe. Can you help me out making a simple service. Thanks
For future reference, you should include the full exception stack. :-) Beyond that it reads like you are missing a dependancy. Fusion is trying to resolve runtime depedancies and fails to find one so it never runs let alone run as a Windows Service. Fix that first.
-
Hi Everyone, I have created a service with the help of dotnet framework and without the help of MSI(Installshield). I want to see my service(WindowsService_1) in Windows Service and using "installutil tools" (which Microsoft provided) which install my service in windows service but exception is raised "Exception occurred while initializing the installation: System.IO.FileNotFoundException: File or assembly name windowsservice_1.exe, or one of its dependencies, was not found.." So I am following each and everystep which is given on MSDN example and other site. I want to write a service without using MSI(Installshield). I go to command prompt(cmd) and write "InstallUtil windowsservice_1.exe". But is throwing an exception. I am giving full path of InstallUtil.exe. Can you help me out making a simple service. Thanks
In MSI you should use the File key (and the Visual Studio .NET Windows Installer project will continually change this on you) as the argument with quotes, like
installutil "[$fileKey]"
. You must also either get the full path to installutil.exe by using [WindowsFolder]Microsoft.NET\Framework\v1.1.4322\installutil.exe for .NET 1.1, for example. This can get tricky. The exception is most likely because one of the assemblies your windowsservice_1.exe assembly depends on is not found. Please read How the Runtime Locates Assemblies[^] for more information. You can also see what assembly is missing by running fuslogvw.exe from the .NET Framework directory. Finally, you MUST make sure the client has the .NET Framework - to correct version, or you'll need to use a publisher policy - installed or none of this will work. If you write managed code, the runtime is required to run it. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog] -
In MSI you should use the File key (and the Visual Studio .NET Windows Installer project will continually change this on you) as the argument with quotes, like
installutil "[$fileKey]"
. You must also either get the full path to installutil.exe by using [WindowsFolder]Microsoft.NET\Framework\v1.1.4322\installutil.exe for .NET 1.1, for example. This can get tricky. The exception is most likely because one of the assemblies your windowsservice_1.exe assembly depends on is not found. Please read How the Runtime Locates Assemblies[^] for more information. You can also see what assembly is missing by running fuslogvw.exe from the .NET Framework directory. Finally, you MUST make sure the client has the .NET Framework - to correct version, or you'll need to use a publisher policy - installed or none of this will work. If you write managed code, the runtime is required to run it. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Customer Product-lifecycle Experience Microsoft [My Articles] [My Blog]