Windows service incorrect function
I am currently creating a Windows service. I've got everything finished and can deploy it to me test server. But when I try to start the service I get Error 1: Incorrect function
. The weird thing is that it's happening on a method call. The relevant code sections look like this:
public CacheManager(Logger logger, QueueSettings settings)
{
_logger = logger;
_logger.WriteLog("checkpoint #1.1");
FillCache();
_logger.WriteLog("checkpoint #1.2");
}
private void FillCache()
{
_logger.WriteLog("checkpoint #1.1.1");
Utils.RefreshSession(ref _session, _user, _password, _appServer);
_logger.WriteLog("checkpoint #1.1.2");
Parts = new PartCache(ref _session);
_logger.WriteLog("che开发者_运维知识库ckpoint #1.1.3");
Customers = new CustomerCache(ref _session);
_logger.WriteLog("checkpoint #1.1.4");
lastUpdate = DateTime.Now;
_logger.WriteLog("checkpoint #1.1.5");
}
According to the logs, I am reaching checkpoint #1.1 but not checkpoint #1.1.1. The error that is coming back is:
Could not start the JediProcessDocuments service on the local computer.
Error1: Incorrect function.
Any ideas?
So it turns out that the DLL containing the Session object (the variable _session in the code sample wasn't deployed). I guess that windows services defer loading DLLs until the actual method that needs the DLL is called and doesn't detect the non-presence until then.
精彩评论