app.config 创建和读取部分的问题
我一直在尝试通过以下示例使用 app.config 部分:
并给了我下一个例外:
为 MyUrls 创建配置节处理程序时发生错误: 无法加载文件或程序集“ConfigurationCollectionAttribute,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一。系统找不到指定的文件。 (E:\Projects\AppConfigSectionsTesting\AppConfigSectionsTesting\bin\Debug\AppConfigSectionsTesting.vshost.exe.Config line 4)
这是配置文件 -
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MyFolders" type="FoldersSection,
ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<MyFolders>
<Folders>
<add Path ="D:\\RUN"/>
</Folders>
</MyFolders>
</configuration>
我不明白为什么......任何人都可以帮忙吗? 谢谢。
I have been trying to work with app.config sections by this example:
and its giving me the next exception:
An error occurred creating the configuration section handler for MyUrls:
Could not load file or assembly 'ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. (E:\Projects\AppConfigSectionsTesting\AppConfigSectionsTesting\bin\Debug\AppConfigSectionsTesting.vshost.exe.Config line 4)
this is the config file -
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MyFolders" type="FoldersSection,
ConfigurationCollectionAttribute, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<MyFolders>
<Folders>
<add Path ="D:\\RUN"/>
</Folders>
</MyFolders>
</configuration>
i dont understand why.... can anyone help?
thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 app.config 中,检查您是否拥有类
ConfigurationCollectionAttribute
的完整命名空间,例如:
In your app.config, check that you've got the full namespace to the class
ConfigurationCollectionAttribute
For example: