当我使网站在线且在本地时出错,没有错误 [英] Error when I am making site online and on local there is no error

查看:63
本文介绍了当我使网站在线且在本地时出错,没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在本地运行以下代码时,它可以正常工作,但是在firefox上出现以下错误:

When I run the following code locally it works fine, but I get the following error on firefox:

XML Parsing Error: no element found
Location: http://test.freecreditcards4all.com.asp1-10.dfw1-2.websitetestlink.com/testforconnection.aspx
Line Number 1, Column 1:

代码为:

protected void Button1_Click(object sender, EventArgs e)
    {
     try
        {
         SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["PintooConnection"].ConnectionString);
            DataSet Ds = new DataSet();
            SqlDataAdapter Da = new SqlDataAdapter("Select * from Emails", con);
            Da.Fill(Ds);

            for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
            {
               Label1.Text = Label1.Text + i.ToString() ++ Ds.Tables[0].Rows[i][1].ToString() + " <br />";
                SqlConnection test = new SqlConnection(WebConfigurationManager.ConnectionStrings["PintooConnection"].ConnectionString);
                string qry = "Insert into test values ('" + Ds.Tables[0].Rows[i][1].ToString() + "','" + Ds.Tables[0].Rows[i][2].ToString() + "','" + Ds.Tables[0].Rows[i][3].ToString() + "','" + Ds.Tables[0].Rows[i][4].ToString() + "','" + Convert.ToDateTime(Ds.Tables[0].Rows[i][5].ToString()) + "')";
                SqlCommand cmd = new SqlCommand(qry, con);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();
                cmd.Dispose();
            }
        }
        catch (Exception ex)
        {
            Label1.Text = ex.ToString();
        }
    }


.aspx代码在这里:


.aspx code is here:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testforconnection.aspx.cs" Inherits="Admin_testforconnection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

    </div>
    <asp:Label ID="Label1" runat="server" Text=""></asp:Label>
    </form>
    <% Response.ContentType = "text/HTML";%>
</body>
</html>

推荐答案

错误表明没有内容已返回到浏览器
测试一下.您尚未说明在
之后是否会发生此异常 按下按钮,或者根本无法进入该网站.

如果您在任何地方都找不到内容,则表明按下按钮不是问题.
The error indicates that no content has been returned to the browser to
test it. You haven''t indicated whether this exception occurs after a
button press, or if you can''t get into the site at all.

If you can get no content anywhere, it indicates the button press is not the problem.


我建​​议您阅读这篇文章.
http://shivasoft.in/blog/microsoft/net/xml-parsing -error-no-element-found/ [
i will suggest to read this post.
http://shivasoft.in/blog/microsoft/net/xml-parsing-error-no-element-found/[^]

it may solve your problem


好吧,我会再次添加答案.

该错误表示您的应用程序根本无法产生任何输出.通常,这意味着在进行任何输出呈现之前都存在异常.
您是否有异常处理?如果是,请尝试查看日志以找出原因.您可以检查事件日志条目中是否有任何异常.
如果无法解决问题,请尝试在Global.asax文件的Application_Error部分记录错误.

希望对您有所帮助!
Okay, I will add the answer again.

The error means your application failed to produce any output at all. Usually that means that there was an exception before any output rendering took place.
Do you have exception handling in place? If yes, try looking through the logs to find out what caused it. You may check Event Log entries for any exception.
If nothing works out, try logging the error in Application_Error section in Global.asax file.

Hope it helps!


这篇关于当我使网站在线且在本地时出错,没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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