C# 使用IntegratedSecurity时获取SSL提供程序错误

C# 使用IntegratedSecurity时获取SSL提供程序错误,c#,asp.net,sql-server-2008,C#,Asp.net,Sql Server 2008,但我得到了以下错误: SqlConnection cnn=新的SqlConnection(); cnn.ConnectionString=“数据源=;数据库=deptStore;集成安全性=true;” 但我发现了以下错误: 用户代码未处理SqlException 建立与SQL Server的连接时发生与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。(提供程序:命名管道提供程序,错误:40-无法打开到SQL Ser

但我得到了以下错误:

SqlConnection cnn=新的SqlConnection(); cnn.ConnectionString=“数据源=;数据库=deptStore;集成安全性=true;”

但我发现了以下错误: 用户代码未处理SqlException

建立与SQL Server的连接时发生与网络相关或特定于实例的错误。找不到服务器或无法访问服务器。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。(提供程序:命名管道提供程序,错误:40-无法打开到SQL Server的连接)


请帮助我理解错误并更正它。

确保您已在SQL Server Configuration Manager中启用TCP/IP:


另外,启动SQL Server浏览器服务:

我修复了您的主题以更好地反映问题,并用一些格式整理了您的问题。可能是证书问题检查此帖子
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = "Data Source=.;Database = deptStore;Integrated Security = true;";
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "insert into Employee values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "')";
cmd.Connection = cnn;
cmd.ExecuteNonQuery();
Response.Write("Record Save");
cnn.Close();
            cnn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "insert into Employee values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + TextBox9.Text + "','" + TextBox10.Text + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + TextBox13.Text + "')";
            cmd.Connection = cnn;
            cmd.ExecuteNonQuery();
            Response.Write("Record Save");
            cnn.Close();