wcf c # directory access error

0

I am writing a WCF service using C #. In one of my methods I try to access a directory on the network (any command like directory.Exists() or directory.GetFiles() ) and I get the following error:

  

System.ServiceModel.FaultException '1 [[System.ServiceModel.ExceptionDetail,   System.ServiceModel, Version = 4.0.0.0, Culture = neutral,   PublicKeyToken = b77a5c561934e089]]: Username or Password   incorrect.

If I try to access the same directory from an Web API application it works normally. Has anyone had this problem and could you help me?

    
asked by anonymous 28.03.2018 / 22:30

1 answer

1

The WCF service was showing a generic error message, I changed to show a more specific message and found that it was user problem as they said earlier, to resolve this I created a user on my machine and a on the target machine with the same credentials. After I changed IIS DefaultAppPool to use the user I created. So it was possible to access the directories.

    
29.03.2018 / 13:43