简体   繁体   English

练习web.config并出现错误

[英]Practicing web.config and getting error

I am practcing web.config file from here 我从这里练习web.config文件
when i copy and paste following code : 当我复制并粘贴以下代码时

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

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

I got several errors like : 我遇到了一些错误,例如:

  • tag was not closed on second line. 标签未在第二行关闭。
  • </section> is missing. </section>丢失。
  • the namespace 'section' can not include child element. 名称空间'section'不能包含子元素。

How to remove these errors and run it smoothly. 如何清除这些错误并使其平稳运行。

Instead of 代替

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

Try 尝试

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

See Which are the HTML, and XML, special characters? 请参阅HTML和XML的特殊字符是什么?

You have this: 你有这个:

type ="<ProductSection"

This is invalid in XML, get rid of the "<" character: 这在XML中无效,请删除“ <”字符:

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

If you actually have something with "<", you'll have to encode it like so: 如果实际上带有“ <”的内容,则必须像这样编码:

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

However as the actual section is <ProductSection> it was probably just a typo on your side. 但是,由于实际部分是<ProductSection> ,因此可能只是您这边的错字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM