在 C# 中创建的 Windows 服务执行加载数据文件:不支持给定路径的格式



Windows API也在运行,但在Windows服务中出现问题。。。。

LOAD DATA LOCAL INFILE 'E:/WS/Dump/FInalMainFile01_28Jan2021.csv' INTO TABLE xyz FIELDS TERMINATED BY '|'  IGNORE 1 LINES ;
2021-07-09 18:16:27.0745 ERROR System.NotSupportedException: The given path's format is not supported.
at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
at System.IO.File.WriteAllText(String path, String contents)

'E:/WS/Dump/FInalMainFile01_28Jan2021.csv'不是有效的Windows(DOS(路径名,就像错误消息所说的那样。Windows上的分隔符不是/,而是

你需要'E:WSDumpFInalMainFile01_28Jan2021.csv'。如果在C#程序中处理字符串常量,则需要转义字符。

const string path = "E:\WS\Dump\FInalMainFile01_28Jan2021.csv";

相关内容

  • 没有找到相关文章