0
votes

I'm a little stumped as to why this windows service is not running when using the Network Service account (but does so on other machines using the same code), getting me these two subsequent errors in event viewer:

Application: MyApplication.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 06F3C67E
Stack:

and

Faulting application name: MyApplication.exe, Version: 1.0.0.0, time stamp: 0x87654321
Faulting module name: ReferencedComLib.dll, Version: 1.0.0.0, time stamp: 0x12345678
Exception code: 0xc0000005
Fault offset: 0x0000c67e
Faulting process ID: 0x148c
Faulting application start time: 0x01d4df2e591220f2
Faulting application path: C:\Program Files (x86)\MyApplication\MyApplication.exe
Faulting module path: C:\Windows\SYSTEM32\ReferencedComLib.dll
Report ID: 9d8df956-4b21-11e9-80c8-00155dc82141
Faulting package full name: 
Faulting package-relative application ID: 

This seems to indicate that the service is looking for ReferencedComLib.dll under C:\Windows\SYSTEM32...

But ReferencedComLib.dll is actually located under C:\Windows\SysWOW64 - it's a COM-library from third party (and their installer correctly installs it into SysWOW64)

Running under Local System however this error does not even show up and the service runs without problems - and this problem is currently only reproducable on one stage, on all others it is running fine with Network Service.

How could changing the service account running the service result in a faulting module?

1
The problem is not due to the fact ReferencedComLib is looked for. The report indicates that it's the faulting module => the cause of the problem. The fact you see System32 is normal (every process sees a "System32" that is redirected to the real system directory). Code in ReferencedComLib probably needs local admin rights because it accesses something it cannot when running under network service.Simon Mourier
@SimonMourier yes I think that too, but why would it only fail under one user? Registration of dlls was always done by administrator and not any other account I just try to find out what could be different to the other stages :)DrCopyPaste
Local System is not one user, it's the one god of the machine. You should trace what ReferencedComLib does (for example with a tool such as Process Monitor from sysinternals) or ask its developer for helpSimon Mourier
@SimonMourier ty, this really helped ;) I'll write a more detailed answer later...DrCopyPaste

1 Answers

0
votes

Simon Mourier was right, the problem was internal to the third party dlls I am using and it was trying to access a directory that was under C:\Users....

Reinstalling under a different path that Network Service could access fixed the problem.