【问题标题】:Connect asp.net core app to network drive in windows server domain将 asp.net 核心应用程序连接到 windows 服务器域中的网络驱动器
【发布时间】:2020-06-16 12:52:43
【问题描述】:

我正在使用 asp.net core 2.2 和 angular 9 开发一个内部 Web 应用程序。我希望访问位于同一 Windows 服务器域中的公司文件服务器,以便上传、下载或仅列出以下内容目录。你有办法在本地或使用库吗?

提前谢谢,我有点迷路了。

更新: 我找到了这个方法,但我有错误“访问被拒绝”:

NetworkCredential sourceCredentials = new NetworkCredential { Domain = "domain_name", UserName = "username", Password = "pass" };
            try
            {
                NetworkConnection.NetworkConnection con =
                    new NetworkConnection.NetworkConnection(@"server_destination_directory", sourceCredentials);
                using (con)
                {

                    Console.WriteLine();
                    System.IO.File.Copy(@"server_destination_directory", @"file_to_copy", true);
                }

            }catch(Exception e)
            {
                return NotFound(e);
            }

我有这样的错误“访问被拒绝”:

权限没问题,我激活了windows和匿名认证,问题出在哪里?

【问题讨论】:

    标签: angular asp.net-core windows-server network-drive


    【解决方案1】:

    我找到了解决方案,在目标路径中我需要指定目标文件, 该错误与权限无关

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-25
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多