在 Windows Server 2003 中通过 configSource 访问 AppSettings 时出现问题

发布于 2024-09-11 20:07:48 字数 590 浏览 1 评论 0 原文

根据 MSDN 文档configSource 在 Windows Server 2003 SP2 上受支持。但是,当我尝试使用以下语法访问设置时:

System.Configuration.ConfigurationManager.AppSettings["SettingName"];

则返回 null 。但是,同一个应用程序可以在 Windows 7 和 Windows XP 上正常运行(即,AppSettings["SettingName"] 在使用 configSource 时返回预期值)。

configSource 指向的文件肯定存在,因为我将整个应用程序目录从 Windows 7 复制到 Server 2003 进行测试。

有什么想法吗?

According to the MSDN documentation, configSource is supported on Windows Server 2003 SP2. However, when I try to access a setting using the following syntax:

System.Configuration.ConfigurationManager.AppSettings["SettingName"];

then null is returned. However, the same app works properly on Windows 7 and Windows XP (i.e. AppSettings["SettingName"] returns the expected value when using configSource).

The file that configSource points to exists for sure, since I copied the entire application directory from Windows 7 to Server 2003 for testing.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岛歌少女 2024-09-18 20:07:48

您的应用程序清单文件不完整。您需要添加“ assemblyIdentity”元素。详细信息此处此处还存在一个 MS Connect 错误。

You have an incomplete application manifest file. You need to add the "assemblyIdentity" element. Details here. There is also an MS Connect bug here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文