您好我有一個用於在.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