I have a C# windows service used to pull some files from another machine on the same domain. When I run my windows service as a console application, it pull files from the other computer. However, running it as a windows service return : Invalid credentials for: 192.168.100.53 (ServerNotFoundMIPException)
I tried to change the service Log On as Local Service or Network Service but no success. The following is the OnStart method: [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] protected override void OnStart(string[] args)
In application properties, Security section, I checked Enable ClickOnce security settings, This is a full trust application.
The Credential type I used is:
case CredentialType.Windows:
{
var nc = CredentialCache.DefaultNetworkCredentials;
What I am missing so my windows failed to pull files from the other computer ?
I assume you are reading files from a Windows share, like
\\COMPUTER2\Share\Path\file.ext
.Account under which the server runs must be able to
LocalSystem and LocalService fail at #1. No network access.
NetworkService gives you #1, but fails on #2 - it's a local account and domain controller does not know about it.
What you need is to run the service under a specific domain acount, not local account, and configure that account to be able to logon remotely to COMPUTER2 and have read access to share Share.
Alternatively, you may expose your files via different protocol that does not require authentication, e.g. ftp or http.