Web 服务:global.asax 发出错误

web service: global.asax issuing errors

这是行:

<%@ Application Codebehind="Global.asax.cs" Inherits="WebApiTest" Language="C#" %>

生成:

Error 1 Illegal syntax. Expecting valid start name character.
Error 2 Character '%', hexadecimal value 0x25 is illegal in an XML name. Error 3 The character '@', hexadecimal value 0x40 is illegal at the beginning of an XML name. Error 4 Character '@', hexadecimal value 0x40 is illegal in an XML name.
Error 5 Missing attribute value on attribute 'Application'. Error 6 Character '%', hexadecimal value 0x25 is illegal in an XML name.

但它运行正常,但想消除这些错误,但不确定如何。

代码正确。检查 VS 中文件的默认编辑器,也许您错误地使用了标准 XML 编辑器来编辑 *.asax 文件。