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?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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=9.2.5.0, 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?
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?
I have copied the amqmxmsstd DLL to C:\Windows\SysWOW64\
I now get a different error:
Faulting application name: MyService.exe, version: 1.0.0.0, 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:
Hi @king_moot ,
Check the following link to see if it helps.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/197aed35-544e-4047-965d-da6c3835e4a8/error-in-starting-windows-serviceservice-cannot-be-started-systemiofileloadexception-could-not?forum=netfxbcl
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.
Hi, thanks but I don't think that's the same error. My error doesn't refer to "Assembly binding logging"
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.
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
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 IBM.com 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.