ASP MVC - ConfigurationManager 找不到应用程序设置
我正在使用 MS Test 来测试我的控制器的一项操作。此方法使用 ConfigurationManger 从 web.config 读取 appSettigns。由于某种原因,ConfigurationMangager 无法找到应用程序设置。在 NUNIT 中,我只需确保将 webconfig 文件的副本添加到测试项目中,以便在该上下文中运行时可用。但这对我不起作用。
有人可以告诉我在使用 MS 测试时我需要做什么来确保我的 web.config 处于需要的位置吗?
I am using MS Test to test one of my controller's actions. This method uses the ConfigurationManger to read appSettigns from the web.config. For some reason ConfigurationMangager is not able to find the appsettings. In NUNIT I would just make sure to add a copy of the webconfig file to the test project so that it is available when running in that context. However this is not working for me.
Can someone tell me what I need to do to make sure my web.config is where it needs to be when using MS test?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 app.config 而不是 web.config
Try using app.config instead of web.config