I'm a bit stumped on this one. I'm working on a Microsoft Dynamics CRM 4 system and one of the plugins we have is supposed to create a folder. Now conventional wisdom te开发者_C百科lls me that Directory.CreateDirectory(path); should work fine, and it does if the path is "c:\SomeFolder".
If however the path is "\\machinename\c$\SomeFolder" (because the folders are not to be on the same machine as the CRM system) then I get the rather odd error "You do not have the necessary permissions to change the domain logon name for this user".
I can only assume it has something to do with the user the CRM is actually running under, I've tried tinkering with the folder permissions. Just for my own sanity I set up a basic asp.net app with one page that creates a folder on the same webserver as the CRM and it can create the directory fine.
Any help would be appreciated.
as you said the question here is under what user CRM is running under. If you are running an synchronous plugin take a look at the account of the IIS AppPool. If it is an asynchronous plugin, the account of the CRM Asynchronous Service Windows Service needs to permitted to access the directory. In order to do this it would be the best if the CRM runs under a Domain User account, than you just have to give the domain user account the permissions on the directory and share. If it is running under NetworkService account you need to give the computer account the requured permissions.
And no need to be frustrated ;-)
精彩评论