首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >asp mvc textreader

asp mvc textreader
EN

Stack Overflow用户
提问于 2010-04-21 20:48:36
回答 2查看 316关注 0票数 3

我正在尝试使用textreader从本地计算机上的文本文件中检索数据。我有一个上传例程来让读者打开文件。

当我在本地运行应用程序时,它工作得很好。当我将我的应用程序发布到我的服务器上时,我得到了一个无法找到路径的一部分错误。我认为这个错误与权限有关,因为服务器不能从本地文件系统读取,但我不知道正确的方法来纠正这个问题。

我是否要将应用程序设置为模拟用户?我知道我不可能将每个本地用户机器都设置为允许iusr帐户访问它。

谢谢你的任何想法。

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

代码语言:javascript
复制
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

我尝试了各种帖子的建议,包括将domain\servername$添加到文件夹以允许访问,但似乎都不起作用。

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2010-04-23 00:28:11

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

代码语言:javascript
复制
savedFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(file.FileName));
                    file.SaveAs(savedFileName);

下面的博客帮了我大忙-- http://www.hanselman.com/blog/default.aspx?date=2008-06-28

票数 0
EN

Stack Overflow用户

发布于 2010-04-21 20:51:37

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2682963

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档