您好我有一个用于在.net中写入远程服务器上的文件的代码。当我将输出路径保存为本地驱动器时 - 代码正常工作并创建文件夹和文本文件。但是,当我点到远程服务器,我收到以下错误:在远程服务器上创建文件夹时出错
System.UnauthorizedAccessException: Access to the path '\\ServerName\FolderTest\FolderTest1\AB.txt' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at ...
如果您需要更多的信息,让我知道
强制性问题:您是否有权创建文件夹/文件? – Bobby
添加到@ Bobby的评论,你有远程执行它的权限。即可以在本地系统上打开资源管理器,导航到\\ ServerName \ FolderTest \ ....并创建一个文件夹/文件? –
@詹姆斯德维尔:是的,我能够从资源管理器打开文件夹以及文件夹共享 – Sathish