Reputation: 164
A windows service (viz Email_Tool), which was working fine earlier, has not been working properly lately.
Service Overview
Problem faced
The Email_Tool has not been working as expected since few days. The steps are not getting logged in the log file and the emails are not being sent out.
Steps Taken
We have taken many steps to identify the problem. The following are few of them:
As is clear, the service, which was working earlier, is not working for the shared paths which were used in Production.
Information worth Noting
BaseException
Base exception area gave the following codes:
ErrorCode: -2147467259 Native Error code : 58
The above native error code 58 points to the following(google search)
ERROR_BAD_NET_RESP 58 (0x3A) The specified server cannot perform the requested operation.
InnerException
The inner exception showed the following code:
_COMPlusExceptionCode -532459699 int
Codes
the service start event has this code snippet
m_Watcher = new System.IO.FileSystemWatcher();
m_Watcher.Filter = "*.*";
m_Watcher.Path = @filWatcherPath;
m_Watcher.IncludeSubdirectories = true;
m_Watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
m_Watcher.Created += new FileSystemEventHandler(OnChanged);
// m_Watcher.Error += new ErrorEventHandler(OnError);
m_Watcher.EnableRaisingEvents = true;
As a workaround, we have used another file server temprarily which on which the service is working fine. But we have to find a fix. Please let me know if there is any other information that I must provide. I had posted this question earlier, but I think this post provides more details.
Upvotes: 1
Views: 2431
Reputation: 164
Had found the root cause of this issue. The watched directory was getting detached from the network drive, maybe due to network glitches. Even after the directory was getting attached, the file watcher could not watch this directory until it was restarted.
The solution would be to raise an exception when such a thing happens and then restart the watcher automatically(or any other method to gracefully handle the situation)
There is a flag for this: EnableRaisingEvents. This has to set to true to capture such errors. Read about EnableRaisingEvents here.
Upvotes: 1
Reputation: 77364
There is a sentence in the documentation that reads:
Remote computers must have one of the required platforms installed for the component to function properly.
If your hardware changed, make sure you still have one of the required platforms on the other side of the FileSystemWatcher
.
Upvotes: 0