Skip to main content
 首页 » 编程设计

c#之练习web.config 报错

2024年01月24日27fff_TT

我正在练习 web.config来自 here 的文件
当我复制并粘贴以下代码时:

<configSections> 
  <section name ="ProductSection" type ="<ProductSection" /> 
</configSections> 
 
<ProductSection> 
<gridSettings title ="Latest Products" count ="20"></gridSettings> 
<color background="FFFFCC" foreground="FFFFFF"></color> 
</ProductSection> 

我遇到了几个错误,例如:

  • 标签没有在第二行关闭。
  • </section>不见了。
  • 命名空间'section'不能包含子元素。

如何消除这些错误并顺利运行。

请您参考如下方法:

代替

<section name ="ProductSection" type ="<ProductSection" /> 

尝试

<section name ="ProductSection" type ="&lt;ProductSection" /> 

参见 Which are the HTML, and XML, special characters?