このエラーが発生しました:
-InnerException {"Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while waiting for server to complete the login process and respond; Or it could have timed out while attempting to create multiple active connections. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=86; handshake=2368; [Login] initialization=0; authentication=0; [Post-Login] complete=12018; "} System.Exception {System.Data.SqlClient.SqlException}
これから:
DataSourceContext Context = new DataSourceContext();
var Booklist = Context.Booklists.ToList();
Context.Dispose();
Parallel.ForEach(Booklist, currentBook =>
{
switch (currentBook.FKcatalogNum)
{
case 0:
{
...
finally
{
currentBook.BookDetails = Models.DBBookSourceInitializer.GetBookReaderNet(currentBook.Link);
try
{
context.Booklists.AddOrUpdate(currentBook);
context.SaveChanges();
}
catch (Exception e)
{
...
context.Booklists.AddOrUpdate(currentBook);
context.SaveChanges();
}
context.Dispose();
}
break;
データベースからすべての本のタイトルを取得し、要約、章、ページ数などの詳細を追加しようとしていますが、接続エラーが発生し続けます。何千冊もの本があり、一定量のものが処理された後、このエラーが発生します。最後に処理された本の主キーから判断すると、それは 1180 です。つまり、1180 本が正常に処理され、突然これが発生したことを意味します。誰かが私が間違っていること、または何を変更すべきかを教えてもらえますか? 助けてくれてありがとう。