访问其他服务器时拒绝访问

问题描述 投票:0回答:1

我的应用程序托管在192.14.14.22服务器上,并尝试从192.14.253.25 D驱动器中的另一个目录获取文件名列表,这是我们获得访问被拒绝的问题,但我可以访问//192.14.253.25/d来自run命令的$。我知道这是一个经常出现的问题,但我的查询是知道如何访问文件,因为我能够从我的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;
        }
c# asp.net asp.net-mvc linq
1个回答
0
投票

我在web配置中使用下面的键解决了这个问题

<identity impersonate="true" userName="vcvcplicationrobot" password="xxxxxx"/>
© www.soinside.com 2019 - 2024. All rights reserved.