実行に時間がかかる Update ストアド プロシージャを含む QueriesTableAdapter があります。ストアド プロシージャが呼び出されるクエリ テーブル アダプタのコマンド タイムアウト プロパティを増やそうとしています。
ストアド プロシージャは、Web サービスを介して 1 つのプロセスによってまれに呼び出されるメンテナンス ルーチンです。
注意: これは、TableAdapter ではなく、QueriesTableAdapter であり、.net 4.5 VS 2012 を使用しています。
DAL のコード ビハインドに、次のコードを追加しました。
Namespace mbr_AccountTableAdapters
    Partial Public Class QueriesTableAdapter
        ''' <summary>
        ''' Sets the commant timeout.
        ''' Set to 0 to specify the longest timout value supported by the db.
        ''' </summary>
        Public WriteOnly Property CommandTimeout As Integer
            Set(value As Integer)
                If Not IsNothing(Me._commandCollection) Then
                    For Each cmd As System.Data.IDbCommand In Me._commandCollection
                        cmd.CommandTimeout = value
                    Next
                End If
            End Set
        End Property
    End Class
End Namespace
その後、BLL から次のコードを使用して、ストアド プロシージャを実行できます。
Dim rows As Integer = 0 'number of affected rows
Using myQTA As New DAL.mbr_AccountTableAdapters.QueriesTableAdapter
    'increase the command timeout:
    myQTA.CommandTimeout = 0 '0 = larget value possible
    Dim queryResult As Object
    queryResult = myQTA.usrsp_mbr_account_CleanupInactive()
    If Not IsNothing(queryResult) Then
        rows = Convert.ToInt32(queryResult)
    End If
End Using
次のエラーが表示されます。
[Win32Exception (0x80004005): 待機操作がタイムアウトしました]
[SqlException (0x80131904): タイムアウトが発生しました。操作が完了する前にタイムアウト時間が経過したか、サーバーが応答していません。]
クエリが機能することに注意してください。接続やその他のエラーに問題はありません。処理が必要なデータの量をデータの小さなサブセットに減らすと、クエリはエラーなしで実行されます。
問題は、30 秒以上かかる場合です。
クエリは 30 秒後に正確にタイムアウトします。
web.config のデータベース接続文字列に 'Connection Timeout=90' を追加しても違いはありませんが、それでも 30 秒後にタイムアウトします。