在执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。 部署我的网站时出现此错误。我的网站显示错误行" con.Open()"。 异常详细信息:System.ComponentModel.Win32Exception:找不到网络路径 源文件:\ smb-whst-www02 \ whst_www02 $ \ ff8b1b \ user \ fareshoppers.co.uk \ web \ signinregistration.aspx.cs行:73 第73行是con.Open() 我可以轻松登录本地服务器,但在部署后出现此错误
protected void Button1_Click1(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
con.Open();
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM [Login] WHERE Email = @email AND Password = @password", con);
using (con)
{
sda.SelectCommand.Parameters.AddWithValue("@email", this.textboxemail.Text);
sda.SelectCommand.Parameters.AddWithValue("@password", this.textboxpassword.Text);
sda.Fill(dt);
if (dt.Rows.Count == 0)
{
textboxemail.Text = "";
textboxpassword.Text = "";
Label3.Visible=true;
return;
}
string txt = textboxemail.Text;
Session["Email"]=txt;
Response.Redirect("index.aspx");
} }
答案 0 :(得分:0)
确保您可以从部署应用程序的服务器访问数据库服务器。为此:转到应用程序服务器并ping" ISL-4"。一般来说 - ping应该工作。如果它没有 - 您可能需要更改连接字符串或以其他方式确保数据库在" ISL-4"机器对应用程序服务器可见。