当许多客户端试图写入 table 时,为什么会出现 SQL 服务器错误?

Why the SQL Server error when many clients are trying to write to a table?

我在大约 200 台机器上有一个简单的程序,可以记录用户打开的表单。每次打开一个表单时,都会打开一个 Sql 连接,插入一行,我想连接已关闭?我读到默认情况下连接池是打开的,所以我猜它并没有真正关闭它?我不允许调用 Web 服务或可能更好的方法,所以我的问题是为什么会出现此错误,是否存在以及如何解决?或者 SQL 端的东西?也许我可以尝试更改设置?

   using (SqlConnection connection = new SqlConnection(connectionString))
        {
            try
            {
                connection.Open();

                using (SqlCommand command = new SqlCommand(
                "INSERT INTO LoggerLoanForm VALUES(@Session, @Form, @DateStamp, @LoanNumber)", connection))
                {
                    command.Parameters.Add(new SqlParameter("Session", llf.SesssionId));
                    command.Parameters.Add(new SqlParameter("Form", llf.Form));
                    command.Parameters.Add(new SqlParameter("DateStamp", llf.DateStamp));
                    command.Parameters.Add(new SqlParameter("LoanNumber", llf.LoanNumber));

                    command.ExecuteNonQuery();
                }


            }
            catch (Exception ex)
            {
                AppInsightHelper.TrackException(ex);
            }
        }

建立与 SQL 服务器的连接时出现与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确并且 SQL 服务器配置为允许远程连接。 (provider: TCP Provider, error: 0 - The requested name is valid, but no data of the requested type was found.)The requested name is valid, but no data of the requested type was found

错误似乎在高峰时段发生得更多,所以我猜 SQL 服务器没有足够的开放连接或其他什么?

重试如何

        const int max_try = 5;

        int i = max_try;

        while (i-- > 0)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                try
                {
                    connection.Open();

                    using (SqlCommand command = new SqlCommand(
                    "INSERT INTO LoggerLoanForm VALUES(@Session, @Form, @DateStamp, @LoanNumber)", connection))
                    {
                        command.Parameters.Add(new SqlParameter("Session", llf.SesssionId));
                        command.Parameters.Add(new SqlParameter("Form", llf.Form));
                        command.Parameters.Add(new SqlParameter("DateStamp", llf.DateStamp));
                        command.Parameters.Add(new SqlParameter("LoanNumber", llf.LoanNumber));

                        command.ExecuteNonQuery();
                        i = 0;
                    }


                }
                catch (Exception ex)
                {
                    if (i == 0) 
                            AppInsightHelper.TrackException(ex);
                      System.Threading.Thread.Sleep(50);

                }
            }
        }