Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net asp mvc文本阅读器_Asp.net_Asp.net Mvc - Fatal编程技术网

Asp.net asp mvc文本阅读器

Asp.net asp mvc文本阅读器,asp.net,asp.net-mvc,Asp.net,Asp.net Mvc,我正在尝试使用文本阅读器从本地机器上的文本文件检索数据。我有一个上传例程来获取文件以便读者打开 当我在本地运行应用程序时,它工作正常。当我将我的应用程序发布到我的服务器时,我遇到了一个无法找到部分路径的错误。我假设这个错误与权限有关,因为服务器无法从本地文件系统读取数据,但我不知道正确的补救方法 我是否将应用程序设置为模拟用户?我知道我不可能设置每台本地用户计算机以允许iusr帐户访问它 谢谢你的想法 更新**** 我确保网络服务是应用程序池的用户。我还确保networkService可以访问应

我正在尝试使用文本阅读器从本地机器上的文本文件检索数据。我有一个上传例程来获取文件以便读者打开

当我在本地运行应用程序时,它工作正常。当我将我的应用程序发布到我的服务器时,我遇到了一个无法找到部分路径的错误。我假设这个错误与权限有关,因为服务器无法从本地文件系统读取数据,但我不知道正确的补救方法

我是否将应用程序设置为模拟用户?我知道我不可能设置每台本地用户计算机以允许iusr帐户访问它

谢谢你的想法

更新**** 我确保网络服务是应用程序池的用户。我还确保networkService可以访问应用程序所在的本地文件夹。我正在运行IIS7,当我测试站点时,我得到了错误-

The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that <domain>\<computer_name>$ has Read access to the physical path. Then test these settings again
服务器配置为使用内置帐户的直通身份验证来访问指定的物理路径。但是,IIS管理器无法验证内置帐户是否具有访问权限。确保应用程序池标识具有对物理路径的读取权限。如果此服务器已加入域,且应用程序池标识为NetworkService或LocalSystem,请验证\$是否具有对物理路径的读取权限。然后再次测试这些设置
我尝试过各种帖子的建议,包括向文件夹中添加domain\servername$以允许访问,但似乎没有任何效果


有什么想法吗?

假设这是IIS 6.5或更高版本,应用程序池用户必须具有必要的权限。默认情况下,这是网络服务,可能不是

我解决了这个问题,首先将文件保存到服务器,然后访问服务器的本地文件-

savedFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(file.FileName));
                    file.SaveAs(savedFileName);

下面的博客帮了我的忙-

需要什么权限?本地用户文件系统?它被定义为网络服务。