최근에 새 웹 사이트가 시작되었습니다 ... 피크 시간 동안 약 150 명의 사용자가 활발하게 활동하고 있습니다. 피크 시간에는 몇 분마다 문제가 발생하며 예외 텍스트는 아래에 나와 있습니다.SQL Server 연결 문제
System.Web.HttpUnhandledException:
Exception of type 'System.Web.HttpUnhandledException' was thrown.
---> System.Data.SqlClient.SqlException: The client was unable to establish a connection because of an error during connection initialization process before login.
Possible causes include the following:
the client tried to connect to an unsupported version of SQL Server;
the server was too busy to accept new connections;
or there was a resource limitation (insufficient memory or maximum allowed connections) on the server. (provider: Named Pipes Provider, error: 0 - No process is on the other end of the pipe.)
데이터 액세스 레이어는 다음 구문을 사용하여 다양한 DataTableAdapter를 호출합니다.
편집
예, da
는 DataTableAdapter에 할당 된 이름입니다. DataTableAdapter가 모든 것을 처리하기 때문에 connection.Open()
이 없습니다.
<add name="MyConnectionString"
connectionString="Data Source=myDBServerName;Initial Catalog=MyDB;User ID=MyUserName;Password=MyPassword"
providerName="System.Data.SqlClient" />
내가 코드에있는 문제를 배제하기 위해 노력하고있어 :
using(TheDataLayer.some.strongly.typedNameTableAdapters.suchAndSuchTableAdapter da = new TheDataLayer.some.strongly.typedNameTableAdapters.suchAndSuchTableAdapter())
{
StronglyTyped.DataTable dt = new StronglyTyped.DataTable();
da.FillByVariousArguments(dt, ..., ...);
//da.Dispose();
return something;
}
연결 문자열은 같이 보입니다. 이 문제를 최소화하기 위해 할 수있는 "단순한"것이 있습니까?
감사합니다.
'using' 문을 사용하는 경우 왜 그 안에'Dispose()'를 호출하는 이유가 무엇입니까? –
당신은'conn.Open'이 일어나는 코드를 보여 주어야 할 것입니다. 바로 지금 우리는 그것을 보지 못합니다. 그게 문제가되는 곳입니다. –
네, 이해합니다 .Dispose()는 불필요하고 중복 적이 지 않지만이 문제의 원인이되지는 않습니까? 나는주의의 측면에서 실수하려고 노력했다. 지금은 그 라인을 무시하십시오 ~ – Robert