为什么尝试从 ProgramFiles/MyApp 读取文件时出现访问被拒绝的情况?
我试图从 ProgramFiles/MyApp 中的配置文件中读取数据,但在 Windows 7 中它会抛出拒绝访问的异常,对于 ProgrammData/MyApp 中的文件来说是相同的:
fileStream = new FileStream(this.StorageName, FileMode.Open ,文件访问.读取);
是不是只能从这些文件夹中读取?
I am trying to read from a config file in ProgramFiles/MyApp but in Windows 7 it throws an exception for Access denied, it is the same and for a file in ProgrammData/MyApp:
fileStream = new FileStream(this.StorageName, FileMode.Open, FileAccess.Read);
Is not it allowed to read only from these folders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个:
http://social. msdn.microsoft.com/forums/en-us/windowsgeneraldevelopmentissues/thread/53660459-EC32-4819-9213-5190F5A1B885
这似乎是UAC问题,您应该根据nmahajan重新定位您的信息。
这个更好:
http://social.msdn。 microsoft.com/Forums/en/windowsgeneraldevelopmentissues/thread/dd28741a-1025-4ca2-a88b-95a5ea156e7f
引用 GTVic:
take a look at this:
http://social.msdn.microsoft.com/forums/en-us/windowsgeneraldevelopmentissues/thread/53660459-EC32-4819-9213-5190F5A1B885
it seems to be an UAC issue, and you should relocate your information according to nmahajan.
This one is even better:
http://social.msdn.microsoft.com/Forums/en/windowsgeneraldevelopmentissues/thread/dd28741a-1025-4ca2-a88b-95a5ea156e7f
Quoting GTVic: