如何解决XML解析错误:找不到元素? [英] How to resolve XML parsing error: no element found?

查看:132
本文介绍了如何解决XML解析错误:找不到元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页上出现错误





XML解析错误:找不到元素

地点:http:// localhost:22888 / UpdateConfig.aspx

第1行,第1列:

^



我尝试了什么:



I am getting an error on my pages


XML Parsing Error: no element found
Location: http://localhost:22888/UpdateConfig.aspx
Line Number 1, Column 1:
^

What I have tried:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;

namespace Test
{
    public partial class UpdateConfig : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            try
            {
                
            }
            catch (Exception ex)
            {
                Response.Write("Exception: " + ex.Message);
            } 
        }
    }
}

推荐答案

由于一些奇怪的原因,你.aspx不是格式良好。请检查一下。尝试使用此文件编译ASP.NET解决方案;它没关系,检查它是否正确部署(很可能,因为你可能使用嵌入在Visual Studio中的HTTP服务器,在这种情况下,你在项目中有完全相同的文件)。



此外,对于简单的检查,您可以将.aspx文件重命名为.xml并使用任何Web浏览器进行测试;它会显示文件中的错误点。



-SA
By some weird reason, you .aspx is not well-formed. Please check it up. Try to compile your ASP.NET solution with this file; it it's fine, check up that it is deployed correctly (most likely, it is, because you probably work with the HTTP server embedded in Visual Studio, in this case, you have exact same files an in the project).

Also, for a simple checkup, you can rename your .aspx file to .xml and test with any Web browser; it will show you the wrong point in the file.

—SA


只需输入Application_error Global.asax中的标签





protected void Application_Error(object sender,EventArgs e)

{



}







无需添加任何错误处理代码
just put Application_error tag in Global.asax


protected void Application_Error(object sender, EventArgs e)
{

}



No need to add any error handling code inside


I think you added  <httpErrors errorMode="Custom" existingResponse="PassThrough"/>
in <system.webserver> (web.config).
Please remove this for a while so that you can see the actual error.
After you get error you can search for actual error.


这篇关于如何解决XML解析错误:找不到元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆