c# - Got System.InvalidOperationException: Method failed with unexpected error code 64 -


i working on getting folder's permission before access in c# console application , path of folder local of ftp.same working on machine when deploy @ production server start throwing error system.invalidoperationexception: method failed unexpected error code 64.

the exact error receive code

system.invalidoperationexception: method failed unexpected error code   64. @ system.security.accesscontrol.nativeobjectsecurity.createinternal(resourcetype resourcetype, boolean iscontainer, string name, safehandle handle, accesscontrolsections includesections, boolean createbyname, exceptionfromerrorcode exceptionfromerrorcode, object exceptioncontext) @ system.security.accesscontrol.filesystemsecurity..ctor(boolean iscontainer, string name, accesscontrolsections includesections, boolean isdirectory) @ system.security.accesscontrol.directorysecurity..ctor(string name, accesscontrolsections includesections) @ uploaddata.foldermanager.isconfiguredfolderaccessible(string path, folder folder) 

the full code thrown error is

 private static void isconfiguredfolderaccessible(string path, folder folder)     {         // if file can opened exclusive access means file         // no longer locked process.         try         {             if (!directory.exists(path))             {                 loghelper.log(string.format("folder not exist on given path {0}. please re-create folder, grant permission , re-start upc utility. ", folder.path), loghelper.loglevel.error);                 mailcomponent.sendmail(string.format("folder not exist on given path {0}. please re-create folder, grant permission , re-start upc utility.", folder.path), "folder not exist");                 return;             }             else             {                 var accesscontrollist = directory.getaccesscontrol(path);                  if (accesscontrollist == null)                 {                     loghelper.log(string.format("accesscontrollist on folder {0} not defined", folder.tostring()), loghelper.loglevel.error);                     mailcomponent.sendmail(folder.tostring(), "accesscontrollist on folder not defined");                 }                 var accessrules = accesscontrollist.getaccessrules(true, true,                                             typeof(system.security.principal.securityidentifier));                  if (accessrules == null)                 {                     loghelper.log(string.format("accessrules on folder {0} not defined", folder.tostring()), loghelper.loglevel.error);                     mailcomponent.sendmail(folder.tostring(), "accessrules on folder not defined");                 }                 foreach (filesystemaccessrule rule in accessrules)                 {                     if ((filesystemrights.write & rule.filesystemrights) != filesystemrights.write)                         continue;                      if (rule.accesscontroltype == accesscontroltype.deny)                     {                         loghelper.log(string.format("access permission denied on folder {0}", path), loghelper.loglevel.error);                         mailcomponent.sendmail(folder.tostring(), string.format("access permission denied on folder {0}", path));                     }                 }             }         }         catch (privilegenotheldexception pv)         {             loghelper.log(string.format("access permission denied on folder {0}, error detail : {1}", path, pv.tostring()), loghelper.loglevel.error);             mailcomponent.sendmail(pv.tostring(), string.format("access permission denied on folder {0}", path));             throw pv;         }         catch (ioexception io)         {             loghelper.log(string.format("folder not exist on given path {0}, error detail : {1}", path, io.tostring()), loghelper.loglevel.error);             mailcomponent.sendmail(io.tostring(), string.format("folder not exist on given path {0}.please re-create folder, grant permission , re-start upc utility.", path));             throw io;         }         catch (exception ex)         {             loghelper.log(string.format("general error occured on folder {0}, error detail : {1}", path, ex.tostring()), loghelper.loglevel.error);             mailcomponent.sendmail(ex.tostring(), "general error occured");             throw ex;         }     } 

the error generated call native windows getsecurityinfo() function. can see in source code nativeobjectsecurity class. error 64 or 0x40 in hex has following definition in winerror.h:

error_netname_deleted

the specified network name no longer available.

so problem related accessing folder across network.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -