gpt4 book ai didi

c# - 如何在IIS中配置连接池?

转载 作者:太空宇宙 更新时间:2023-11-03 10:37:31 26 4
gpt4 key购买 nike

我有一个 3 层应用程序客户端 (WinForm) - 业务(IIS 7.5 上的 WebServices)和数据库(SQLServer 2008 R2)。

目前需要的时候我是这样创建SqlConnection的:

public static SqlConnection getConnection()
{
string conn = string.Empty;
conn = System.Configuration.ConfigurationManager.ConnectionStrings["quality"].ConnectionString;
SqlConnection aConnection = new SqlConnection(conn);
return aConnection;
}

我应该如何从连接池中获取连接并在 IIS 中配置它?

最佳答案

连接池在 ADO.NET 中是自动的。您很可能不需要知道它的存在。你的代码很好。请务必在完成后释放连接。

国际空间站与此无关。 IIS 也没有。

关于c# - 如何在IIS中配置连接池?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27075439/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com