【问题标题】:Access Denied when Accessing another server访问另一台服务器时拒绝访问
【发布时间】:2017-12-27 12:26:31
【问题描述】:

我的应用程序托管在 192.14.14.22 服务器中,并尝试从 192.14.253.25 D 驱动器中的另一个目录获取文件名列表,这就是我们得到的地方拒绝访问问题,但我可以从运行命令访问 //192.14.253.25/d$。我知道这是一个常见问题,但我的问题是知道如何访问文件,因为我可以从我的 PC 和运行但不能从应用程序访问它。下面是我的代码。

[NonAction]
        public List<FilesListDTO> GetList()
        {
            List<FilesListDTO> lstFiles = null;

            try
            {
                lstFiles = new List<FilesListDTO>();

                DirectoryInfo dir = new DirectoryInfo(@'//192.14.253.25/d$');

                lstFiles = dir.GetFiles().OrderBy(x => x.FullName).Select(x => new FilesListDTO
                {
                    Filename = x.FullName.Replace(CDMSServerPath, string.Empty),
                    DateModified = x.CreationTimeUtc
                }).OrderByDescending(c => c.DateModified).ToList();
            }
            catch (Exception ex)
            {
                Util.WriteLog("GetList Error:" + ex.Message);
            }

            return lstFiles;
        }

【问题讨论】:

  • 应用程序是在您自己的帐户下运行的还是在服务用户下运行的?如果不是您自己的,您需要将该帐户权限授予服务器,可能是您使用隐藏驱动器共享时的管理员权限。
  • @Kumar_Vikas 我添加了模拟密钥
  • @Rhumborl 两台服务器都在管理员权限下,属于我工作的同一家公司
  • @sainath 你能检查目录的共享权限吗?也许里面有东西。

标签: c# asp.net asp.net-mvc linq


【解决方案1】:

我通过在 web config 中使用以下键解决了这个问题

<identity impersonate="true" userName="vcvcplicationrobot" password="xxxxxx"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-14
    • 1970-01-01
    • 2013-08-02
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 1970-01-01
    相关资源
    最近更新 更多