Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to write a simple service

How to write a simple service

Scheduled Pinned Locked Moved C#
tutorialcsharptoolshelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dwark106
    wrote on last edited by
    #1

    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

    T H 2 Replies Last reply
    0
    • D dwark106

      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

      T Offline
      T Offline
      Tom Larsen
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • D dwark106

        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

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        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]

        D 1 Reply Last reply
        0
        • H Heath Stewart

          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]

          D Offline
          D Offline
          dwark106
          wrote on last edited by
          #4

          Thanks a lot everyone. I got my answer and now I can successfully see service in windows service. Once again Thanks

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups