Windows Service written in Visual Studio 2022 won't start

king_moot 1 Reputation point

Hi, I have written a windows service using Visual Studio 2022. The service utilises an IBM Library that was pulled into the project using Visual Studio's NuGet package manager.

I tested the code beforehand by writing a class library and testing it in a class module (vb). It worked once the IBM Library was pulled into the Console Application via the NuGet package manager.

I want to use this code as a windows service, so I wrote a Service, and pulled in the code. The class module has a single public sub which does all the work. The service calls that Sub. Again, I added the DLL to the project via the NuGet package manager.

When you compile the service, it appears to put the exe and related DLLs in the release folder.

I copied these files to a C:\Program Files\ area and installed the service using the .NET installutil utility.

However, when I run up the service, I get this error:

tmrService_Tick() failed:Could not load file or assembly 'amqmxmsstd, Version=, Culture=neutral, PublicKeyToken=d2666ab12fca862b' or one of its dependencies. The system cannot find the file specified.

Interestingly, the compiled console application DOES work when I run the EXE...but I can't seem to get the service to start. How do I distribute the windows service exe and related DLLs so that the service will start?

If there are dependencies to amqmxmsstd, how would I work out what they are?

An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,661 questions
{count} votes

6 answers

Sort by: Most helpful
  1. king_moot 1 Reputation point

    Could it be that the DLLs have to be copied somewhere else on the server, rather than alongside the Service binary exe?

    Any ideas about that?

    0 comments No comments

  2. king_moot 1 Reputation point

    I have copied the amqmxmsstd DLL to C:\Windows\SysWOW64\

    I now get a different error:

    Faulting application name: MyService.exe, version:, time stamp: 0xda21fcfc
    Faulting module name: ntdll.dll, version: 10.0.19041.1566, time stamp: 0xbde09443
    Exception code: 0xc0000374
    Fault offset: 0x000e6d03
    Faulting process ID: 0x72e8
    Faulting application start time: 0x01d8638e9a147894
    Faulting application path: C:\Program Files\MyService\MyService.exe
    Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
    Report ID: b2756903-acc4-4e89-bc6d-fb0fd313a79d
    Faulting package full name:
    Faulting package-relative application ID:

    0 comments No comments

  3. Jiachen Li-MSFT 29,026 Reputation points Microsoft Vendor

    Hi @king_moot ,
    Check the following link to see if it helps.
    Best Regards.
    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  4. king_moot 1 Reputation point

    Hi, thanks but I don't think that's the same error. My error doesn't refer to "Assembly binding logging"

    0 comments No comments

  5. MotoX80 32,736 Reputation points

    I have copied the amqmxmsstd DLL to C:\Windows\SysWOW64\

    Is your service compiled as 32 bit and is that the 32 bit version of the amqmxmsstd.DLL?

    You might want to trace the service startup with process monitor.

    I believe that when your service starts, the current working directory will be C:\Windows\system32 (or maybe syswow64 for 32 bit). If your dependent dll's are over in C:\Program Files\SomeDir, then Windows might not be able to find them. If the dll's are registered in the GAC, then they should be found.

    Tracing the startup with procmon will show you the dll's it's looking for and what directories it's searching.

    Did you also install a MQ client or MQ SDK? I don't know what's required these days. You might have to search the documentation.

    I'll apologize in advance, it's been a number of years since I last wrote a service or played with MQ. Hope this helps.

    0 comments No comments