Directory.GetFiles在网站上检索不到文件

buller 2014-02-27 05:14:52
我这(XP)是正常的,能检索到文件夹下的文件,路径用的绝对路径:
foreach (string files in Directory.GetFiles("E:/Data/Pic/"))


放网站(Windows7)上之后,报错(路径是对的):

Server Error in '/' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
PACS_INFO.Default.bind() +3381
PACS_INFO.Default.Page_Load(Object sender, EventArgs e) +742
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.UI.Control.LoadRecursive() +70
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
...全文
584 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
花开是心碎了 2014-02-28
  • 打赏
  • 举报
回复
权限不够吧。
风一样的大叔 2014-02-28
  • 打赏
  • 举报
回复
http://wenku.baidu.com/link?url=YtkUiEPMeZDvHzkeS22fgWWImM2xrDFdpfWD4sss3xVGDhB6pDnoLmbu4OzTv31IIaECo8vZHlzj4xpqbd-ATW9PYfPxfRW44iGgzcVViU3
buller 2014-02-28
  • 打赏
  • 举报
回复
怎样获取权限呢?文件夹也是在网站内的
winner2050 2014-02-27
  • 打赏
  • 举报
回复
报告的异常跟你说的根本挨不上。
q107770540 2014-02-27
  • 打赏
  • 举报
回复
权限问题 win7上是IIS7了吧
  • 打赏
  • 举报
回复
"E:/Data/Pic/"改为“E:\\Data\\Pic”试试,表示路径不能用除法号吧
本拉灯 2014-02-27
  • 打赏
  • 举报
回复
因为你所在的网站上 没有访问权限 你在xp上是用管理员权限所以可以看到

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧