VS 2010: An error occurred loading a configuration file: Failed to map the path ‘/’.

本文介绍了一个在Windows 7下由于用户账户控制(UAC)导致的应用程序无法加载配置文件的问题,并提供了解决方案。作者在本地开发环境中遇到此问题,但在生产环境中一切正常。最终发现是因为Visual Studio在受限权限下运行。通过以管理员身份运行Visual Studio解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

I was using the System.Web.Configuration.WebConfiguration class to open the configuration for the site from one of my logic dll’s and I got the wonderful error An error occurred loading a configuration file: Failed to map the path ‘/’.

I freaked out for a second, until I put more thought into it. This is running fine in production! What is the difference with my machine and the server?

Oh! My Visual Studio is running under UAC with limited privileges since I am in Windows 7. DUH!

So, I restarted Visual Studio 2010 under “Run as Administrator” and problem solved. So if you are on Vista or Windows 7, that’s the issue.

NOTE: If you develop with administrative rights, be careful you don’t make development mistakes that assume everyone will run your program as an admin. i.e. writing to program files directory, root directory, etc.

Happy Coding!

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值