我正在使用Microsoft Visual Web Express 2012 for Web,并且一直在通过Firefox进行测试。
当我最终使用它时,我接着尝试了Chrome和IE,但在两个浏览器上它都会在一个小窗口中报告500内部服务器错误。 html加载很好。我相信这是因为我的网站在标签小部件中加载了数据库信息。重新检查Firefox;好像。重新检查Chrome和IE;同样的错误。
现在可能很明显,但我已经注释掉了ajax代码和IE浏览器并且Chrome没有报告500问题。
我不知道如何找到有关此一般错误的更多详细信息。我试过了
<system.webServer>
<httpErrors errorMode="Detailed" />
<asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
在我的web.config中,但该窗口没有显示500以外的其他内容。我还尝试取消选中“显示友好HTTP错误消息”和“禁用脚本调试(IE)和(其他)”。我不确定应该发生什么,但500消息不会改变。
我注意到Firefox确实显示了从数据库加载的奇怪延迟,但加载后其中的所有数据都很好。
这是有问题的代码。
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
using System.Text;
using System.Web.Script.Services;
/// <summary>
/// Summary description for serverAttempt2
/// </summary>
[WebService(Namespace = "http://idontcare.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[ScriptService]
public class serverAttempt2 : WebService
{
[WebMethod]
public string GetCustomer(string CustomerID)
{
string response = "<p>No customer selected</p>";
string connect = @"Data Source=localhost\SQLEXPRESS;Initial Catalog=personnet;Integrated Security=Yes;";
string query = "SELECT TOP 200 * FROM personnet.dbo.accordionTest";
if (CustomerID != null && CustomerID.Length == 8)
{
StringBuilder sb = new StringBuilder();
using (SqlConnection conn = new SqlConnection(connect))
{
using (SqlCommand cmd = new SqlCommand(query, conn))
{
cmd.Parameters.AddWithValue("CustomerID", CustomerID);
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.HasRows)
{
while (rdr.Read())
{
sb.Append("Hi.");
response = sb.ToString();
/*
sb.Append("<table style='width:100%;'><tr><td style='width:180px;'>");
sb.Append(rdr["pro"].ToString() + "</td><td style='width:20%;'>");
sb.Append(rdr["sn"].ToString() + "</td><td style='width:10%;'>");
sb.Append(rdr["po"].ToString() + "</td><td style='width:20%;' align='center'>");
sb.Append(rdr["qty"].ToString() + "</td><td style='width:10%;' align='center'>");
sb.Append(rdr["status"].ToString() + "</td><td style='width:20%;' align='center'>");
sb.Append("<input type='image' src='images/temporaryStar.png' /></td></tr></table><div><p></p></div>");
response = sb.ToString();*/
}
}
}
}
}
return response;
}
}
我听说过IE的粗鲁兼容性惊喜,但我认为不是这种情况。
编辑:嗯,我找到了一些东西,但我不知道该怎么做。'iexplore.exe' (Script): Loaded 'Script Code (Windows Internet Explorer)'.
Exception was thrown at line 4, column 13743 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 13957 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 10598 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4, column 4377 in http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
0x800a03f6 - JavaScript runtime error: Invalid character
答案 0 :(得分:0)
您应该将以下内容添加到<system.web>
- node:
<customErrors mode="On|Off|RemoteOnly">
要显示详细的错误信息,请将mode
的值设置为Off
。