2012-08-22 6 views
12

約2か月で触れられていないコードをいくつかオープンしました。.NET 4.5でSQL Server Azureに接続するときにハンドシェイク例外が発生する

前回私がアプリケーションを開いたとき、すべての単体テストが渡されました。今はコードで自分のデータユニットテストは、次のエラーで失敗したすべての変更:

Initialization method PerTrac.Pictor.Data.Test.RequestLogRepositoryShould.CreateLog threw exception. System.Data.EntityException: System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The wait operation timed out.) ---> System.ComponentModel.Win32Exception: The wait operation timed out.

が、私はこれに似た既存の質問があり実現しますが、これらのソリューションは、私の状況にどのようなので、今までは効果がなかったです。

エンティティフレームワークとSQL Azureでこのエラーが発生したことがありますか?

私はSSMSから同じ資格情報を使って問題なく接続できることに注意してください。無効なプロトコルでForce Encryptionを設定する必要はなく、ローカルIISを何回かリセットしました。

+0

vs 2012をインストールしましたか? – Tassadaque

+2

なぜそう...はい、私は持っています。 – BentOnCoding

答えて

17

ほとんどの場合、非推奨のネットワークプロトコルを使用してネットワークトラフィックを傍受するコンピュータに、一部のアプリケーションがインストールされている可能性があります。正解は、これらのアプリケーションを無効にするかアンインストールすることです。

ファイル名を指定して実行コマンドラインコマンドのnetshのWinSock表示カタログ>>ファイルを開くために winsock.txt、その後メモ帳winsock.txt。

すべてを参照してください。Winsockカタログプロバイダエントリが返されました。 サービスフラグの値に0x20000ビットが設定されている場合、プロバイダはIFSハンドルを使用して正常に動作します。 "Service Flags" 0x20000ビットがクリア(設定されていない)されている場合、それは非IFS BSPまたはLSPであり、問​​題になる可能性があります。このアプリケーションを無効にして、それが機能したかどうかをお知らせください。

テキストファイルの結果を見ているときに、 "名前空間プロバイダのエントリ"を無視します。彼らは問題ではありません。

以下は、netsh WinSock Showカタログファイルの出力に対してクリーンシステムがどのように見えるかのサンプルです。

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [TCP/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1001 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x20066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [UDP/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1002 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [RAW/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1003 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      3 
Protocol:       0 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [TCP/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1004 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x20066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [UDP/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1005 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      MSAFD Tcpip [RAW/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1006 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      3 
Protocol:       0 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      RSVP TCPv6 Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1007 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x22066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      RSVP TCP Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1008 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x22066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      RSVP UDPv6 Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1009 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x22609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider 
Description:      RSVP UDP Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1010 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x22609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [TCP/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1001 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x20066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [UDP/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1002 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [RAW/IP] 
Provider ID:      {E70F1AA0-AB8B-11CF-8CA3-00805F48A192} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1003 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      3 
Protocol:       0 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [TCP/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1004 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x20066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [UDP/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1005 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      MSAFD Tcpip [RAW/IPv6] 
Provider ID:      {F9EAB0C0-26D4-11D0-BBBF-00AA006C34E4} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1006 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      3 
Protocol:       0 
Service Flags:      0x20609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      RSVP TCPv6 Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1007 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x22066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      RSVP TCP Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1008 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      1 
Protocol:       6 
Service Flags:      0x22066 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      RSVP UDPv6 Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1009 
Version:       2 
Address Family:      23 
Max Address Length:     28 
Min Address Length:     28 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x22609 
Protocol Chain Length:    1 

Winsock Catalog Provider Entry 
------------------------------------------------------ 
Entry Type:       Base Service Provider (32) 
Description:      RSVP UDP Service Provider 
Provider ID:      {9D60A9E0-337A-11D0-BD88-0000C082E69A} 
Provider Path:      %SystemRoot%\system32\mswsock.dll 
Catalog Entry ID:     1010 
Version:       2 
Address Family:      2 
Max Address Length:     16 
Min Address Length:     16 
Socket Type:      2 
Protocol:       17 
Service Flags:      0x22609 
Protocol Chain Length:    1 

Name Space Provider Entry 
------------------------------------------------------ 
Description:      Network Location Awareness Legacy (NLAv1) Namespace 
Provider ID:      {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83} 
Name Space:       15 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      E-mail Naming Shim Provider 
Provider ID:      {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE} 
Name Space:       37 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      PNRP Cloud Namespace Provider 
Provider ID:      {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D} 
Name Space:       39 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      PNRP Name Namespace Provider 
Provider ID:      {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D} 
Name Space:       38 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      Tcpip 
Provider ID:      {22059D40-7E9E-11CF-AE5A-00AA00A7112B} 
Name Space:       12 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      NTDS 
Provider ID:      {3B2637EE-E580-11CF-A555-00C04FD8D4AC} 
Name Space:       32 
Active:        1 
Version:       0 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      WindowsLive NSP 
Provider ID:      {4177DDE9-6028-479E-B7B7-03591A63FF3A} 
Name Space:       12 
Active:        1 
Version:       1 


Name Space Provider Entry 
------------------------------------------------------ 
Description:      WindowsLive Local NSP 
Provider ID:      {229F2A2C-5F18-4A06-8F89-3A372170624D} 
Name Space:       19 
Active:        1 
Version:       1 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      Network Location Awareness Legacy (NLAv1) Namespace 
Provider ID:      {6642243A-3BA8-4AA6-BAA5-2E0BD71FDD83} 
Name Space:       15 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      E-mail Naming Shim Provider 
Provider ID:      {964ACBA2-B2BC-40EB-8C6A-A6DB40161CAE} 
Name Space:       37 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      PNRP Cloud Namespace Provider 
Provider ID:      {03FE89CE-766D-4976-B9C1-BB9BC42C7B4D} 
Name Space:       39 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      PNRP Name Namespace Provider 
Provider ID:      {03FE89CD-766D-4976-B9C1-BB9BC42C7B4D} 
Name Space:       38 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      Tcpip 
Provider ID:      {22059D40-7E9E-11CF-AE5A-00AA00A7112B} 
Name Space:       12 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      NTDS 
Provider ID:      {3B2637EE-E580-11CF-A555-00C04FD8D4AC} 
Name Space:       32 
Active:        1 
Version:       0 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      WindowsLive NSP 
Provider ID:      {4177DDE9-6028-479E-B7B7-03591A63FF3A} 
Name Space:       12 
Active:        1 
Version:       1 


Name Space Provider Entry (32) 
------------------------------------------------------ 
Description:      WindowsLive Local NSP 
Provider ID:      {229F2A2C-5F18-4A06-8F89-3A372170624D} 
Name Space:       19 
Active:        1 
Version:       1 
+1

"サービスフラグ" 0x20000ビットがクリア(設定されていません)とはどういう意味ですか?それはどのように見えるのですか?ありがとう –

5

ここで問題を理解するための鍵はプロバイダであり、あなたのケースでは「SSLプロバイダ」であり、主な問題は接続タイムアウトです。問題が "TCPプロバイダ"と関連していた場合、ネットワークなどに関連するいくつかの理由がありますが、接続フレームワーク内のセキュリティ関連の問題です。

この問題を調査する次のステップは、同じマシン上でSSMSから同じSQLデータベースに接続できますが、IISアプリケーションプロセスは作成するSSLトンネルを作成するための適切な証明書を取得できないことを意味します成功した接続。ログにシステムイベントログが書き込まれている可能性がありますので、そこを確認してください。

するとは、Entity Frameworkを使用して依存EFのバージョンにいくつかの接続文字列であり変更されているので、それはあなたが持っているものであるかどうかを確認しているので最後に

<add name="MyDatabaseModelEntities" connectionString="metadata=res://*/MyDBModel.csdl|res://*/MyDatabaseModel.ssdl|res://*/MyDatabaseModel.msl;provider=System.Data.SqlClient;provider connection string="data source=abcdefg123.database.windows.net;initial catalog=MyDatabase;persist security info=True;user [email protected];[email protected]$$w0rd;multipleactiveresultsets=True;Trusted_Connection=False;Encrypt=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> 

あなたはEF 4.3.1を使用して接続している場合SQLデータベースにthisの記事を見て、同様の設定をしているかどうか確認してください。

+0

セキュリティ面について言及してくれてありがとう。私の場合はLinqPadを使用していましたが、この例外が発生しました。管理者としてLinqPadインスタンスを実行することで問題は解決しました。他の誰かが同じ問題を経験している場合に備えて... – mahonya

0

問題はvs11ベータ版になりました。

あなたはこの問題を持っている場合は、次の操作を行う必要があります。

1)アンインストールVS11ベータと.NET 4.5ベータ

2)再インストール.NET 4.0

ウォッチすべてが再び仕事を!

+2

これは正しい解決策ではありません。これは、正しいプロトコルを使用していないシステム上の他のアプリケーションです。 –

1

この問題は、マイクロソフトの接続サイトhereに報告されています。ソリューションは利用可能ですhere。 IFS以外のLSPがインストールされているWinsock Catalog Providerを削除する必要があります。時には、あなたのマシンに既にインストールされているソフトウェアによっては問題が発生することがあります。非IFS LSPは、最初の問題の原因となったアプリケーションを確認するには、コマンドプロンプトで次のコマンドを実行して除去するために(ref

netsh winsock show catalog > LSP.txt 

出力を確認し、問題の原因となったアプリケーションを分析し、それをアンインストールします。うまくいけば、それは問題を解決するでしょう。

+1

このコマンドを実行しているIIRCは、それ以上の指示なしに無駄だったコマンドライン情報の巨大なリストを私に与えました。これはまさに問題だったのは間違いありませんが、情報を解析する方法がわからない場合はこのコマンドを実行することは無意味です。この質問は何らかの理由で人気があります。 IFS以外のLSPがインストールされているWinsockカタログプロバイダに関する詳細情報と、提供されたコマンドで提供される情報の使用方法について知っているとよいでしょう。 – BentOnCoding

+0

テキストファイルを見て、インストールされたプログラムを見て、犯人を見てください – Tassadaque

1

私の場合、VS2012RCのカップルを修復しようとした後、私はthis linkでチャンスをつきました。コメントの1つは、「sendori」と呼ばれるサードパーティ製のものです。私はそれをアンインストールし、私の世界ではすべて正常に戻っています。

1

もう1つのヒント: SQLサーバーのメモリが不足している可能性があります。私はこのエラーがあり、SQLサーバコンピュータをチェックしたとき、SQLサービスは合計16個のうち15Gのメモリを使用していました。サービスを再起動して修正してください。

+0

DBの大きさはどれくらいですか? SQL Serverは、通常、OSに悪影響を及ぼすことなく、できるだけ多くのメモリを消費します。 – QFDev

0

私はSSMS 2012で同じ問題を抱えていましたが、同じリモートサーバーに接続している同じボックスでSSMS 2008で問題なく動作しました。

Moca.ioプロキシが私に問題を引き起こしていました。アンインストールされ、すべて正常に動作します。 (「非IFS LSPを削除する」)

0

同じ問題がありました。 私の場合、T-Mobile Web 'n Walk Managerをアンインストールして問題を解決しました。 simカード経由でインターネットにモバイル接続するためのソフトウェア Josip

0

この正確なエラーがありました。サーバーをXXXXXXXXXではなく完全なドメイン名XXXXXXXX.YYY.com

に設定することで解決しました。暗号化がサポートされていないとのメッセージが表示されました。

私はすべてがうまくいった。

+0

私はこのページを見つけました。ログイン前のハンドシェイク中にエラーが発生しました。 (プロバイダ:SSLプロバイダ、エラー:0 – arbit

0

ドット "。"を使用している場合は、またはデータソースのサーバーの一部の名前(ドメイン名なし)の場合は、完全なサーバー名で実際のSQL Serverインスタンス名を試してください。

0

エラー:

'接続タイムアウトが切れました。ログイン前のハンドシェイクを使用しようとしたときにタイムアウト時間が経過しなかったか、またはサーバーが時間内に応答できませんでした。このサーバーに接続しようとするのに費やされた時間は - [Pre-Login] initialization = 11977でした。ハンドシェーク= 5138;」

解像度:

この問題は、パラメータを設定するには、接続文字列を変更することで解決できた 『偽のTransparentNetworkIPResolution』を。

例:

サーバー= myServerName;データベース= MYDATABASE; Trusted_Connection =真; TransparentNetworkIPResolution = False

接続文字列でfalseに設定すると、500msでタイムアウトせずに接続が成功します。

https://blogs.msdn.microsoft.com/dataaccesstechnologies/2016/05/07/connection-timeout-issue-with-net-framework-4-6-1-transparentnetworkipresolution/

関連する問題