VB.netでFTP接続を行うプログラムを組んでいますがエラーが発生しFTP接続に失敗するケースがあり何が原因なのか困っております。
このエラーを出ないようにするには、どのように対応すればよろしいでしょうか?
エラー:SSPI への呼び出しに失敗しました。内部例外を参照してください。
SSLの証明書認証に失敗しているように見えます。
このエラーが発生しない端末もあります。
FtpWebRequestでレスポンスを取得できずに落ちます。
WindowsUpdate 2016年3月~9月の間のいずれかを適用すると発生する事が確認できました。何れかのパッチをアンインストールすればよいかと思われますが、どれなのかがわからない状況です。
以下、.netのトレースログを掲載いたします。
System.Net Information: 0 : [4632] FtpControlStream#8368877 - XXXX.XXX.X.XX:62557 から XX.XXX.XXX.XXX:21 への接続を作成しました。
System.Net Information: 0 : [4632] Associating FtpWebRequest#65328864 with FtpControlStream#8368877
System.Net Information: 0 : [4632] FtpControlStream#8368877 - 受信された応答 [220 ProFTPD 1.3.5rc4 Server (ProFTPD Default Installation) [XXX.XXX.XX.XXX]]
System.Net Information: 0 : [4632] FtpControlStream#8368877 - コマンド [AUTH TLS] を送信しています
System.Net Information: 0 : [4632] FtpControlStream#8368877 - 受信された応答 [234 AUTH TLS successful]
System.Net Information: 0 : [4632] TlsStream#7737498::.ctor(host=接続先ドメイン.com, #certs=0)
System.Net Information: 0 : [4632] FtpControlStream#8368877 - コマンド [USER ipharma] を送信しています
System.Net Information: 0 : [4632] SecureChannel#54010872::.ctor(hostname=接続先ドメイン.com, #clientCertificates=0, encryptionPolicy=RequireEncryption)
System.Net Information: 0 : [4632] SecureChannel#54010872 - 0 個のクライアント証明書の中から選択できます。
System.Net Information: 0 : [4632] キャッシュされた資格情報ハンドルを使用しています。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = (null), targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer の長さ = 0、Out-Buffer の長さ =136、返されたコード = ContinueNeeded)。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 0、返されたコード = ContinueNeeded)。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 0、返されたコード = ContinueNeeded)。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 0、返されたコード = ContinueNeeded)。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 0、返されたコード = CredentialsNeeded)。
System.Net Information: 0 : [4632] SecureChannel#54010872 - 0 個のクライアント証明書の中から選択できます。
System.Net Information: 0 : [4632] キャッシュされた資格情報ハンドルを使用しています。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 205、返されたコード = ContinueNeeded)。
System.Net Information: 0 : [4632] InitializeSecurityContext(credential = System.Net.SafeFreeCredential_SECURITY, context = a6f090:545bcf8, targetName = 接続先ドメイン.com, inFlags = ReplayDetect, SequenceDetect, Confidentiality, AllocateMemory, InitManualCredValidation)
System.Net Information: 0 : [4632] InitializeSecurityContext(In-Buffer カウント = 2、Out-Buffer の長さ = 0、返されたコード = MessageAltered)。
System.Net Information: 0 : [4632] FtpWebRequest#65328864::(FTP connection#8368877 を解放しています。)
System.Net Error: 0 : [4632] FtpWebRequest#65328864::GetResponse の例外 - SSPI への呼び出しに失敗しました。内部例外を参照してください。。
場所 System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
場所 System.Net.FtpWebRequest.RequestCallback(Object obj)
場所 System.Net.CommandStream.Dispose(Boolean disposing)
場所 System.IO.Stream.Close()
場所 System.IO.Stream.Dispose()
場所 System.Net.ConnectionPool.Destroy(PooledStream pooledStream)
場所 System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse)
場所 System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
場所 System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [4632] Exiting FtpWebRequest#65328864::GetResponse()
System.Net Verbose: 0 : [4632] WebRequest::Create(ftp://接続先ドメイン.com/接続先フォルダ)
System.Net Information: 0 : [4632] FtpWebRequest#37528343::.ctor(ftp://接続先ドメイン.com/接続先フォルダ)
System.Net Verbose: 0 : [4632] Exiting WebRequest::Create() -> FtpWebRequest#37528343
System.Net Verbose: 0 : [4632] FtpWebRequest#37528343::GetResponse()
System.Net Information: 0 : [4632] FtpWebRequest#37528343::GetResponse(メソッド = PWD。)
System.Net Information: 0 : [4632] FtpControlStream#30475782 - XXXX.XXX.X.XX:62558 から XX.XXX.XXX.XXX:21 への接続を作成しました。
System.Net Information: 0 : [4632] Associating FtpWebRequest#37528343 with FtpControlStream#30475782
System.Net Information: 0 : [4632] FtpControlStream#30475782 - 受信された応答 [220 ProFTPD 1.3.5rc4 Server (ProFTPD Default Installation) [XXX.XXX.XX.XXX]]
System.Net Information: 0 : [4632] FtpControlStream#30475782 - コマンド [USER ipharma] を送信しています
System.Net Information: 0 : [4632] FtpControlStream#30475782 - 受信された応答 [550 SSL/TLS required on the control channel]
System.Net Information: 0 : [4632] FtpWebRequest#37528343::(FTP connection#30475782 を解放しています。)
System.Net Error: 0 : [4632] FtpWebRequest#37528343::GetResponse の例外 - リモート サーバーがエラーを返しました: (550) ファイルが使用できません (例: ファイルが見つからない、ファイルへのアクセスがない)。
場所 System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
場所 System.Net.FtpWebRequest.RequestCallback(Object obj)
場所 System.Net.CommandStream.Dispose(Boolean disposing)
場所 System.IO.Stream.Close()
場所 System.IO.Stream.Dispose()
場所 System.Net.ConnectionPool.Destroy(PooledStream pooledStream)
場所 System.Net.ConnectionPool.PutConnection(PooledStream pooledStream, Object owningObject, Int32 creationTimeout, Boolean canReuse)
場所 System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
場所 System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [4632] Exiting FtpWebRequest#37528343::GetResponse()
System.Net Verbose: 0 : [5852] WebRequest::Create(ftp://接続先ドメイン.com/接続先フォルダ00001/)
System.Net Information: 0 : [5852] FtpWebRequest#48723039::.ctor(ftp://接続先ドメイン.com/接続先フォルダ00001/)
System.Net Verbose: 0 : [5852] Exiting WebRequest::Create() -> FtpWebRequest#48723039
System.Net Verbose: 0 : [5852] FtpWebRequest#48723039::GetResponse()
System.Net Information: 0 : [5852] FtpWebRequest#48723039::GetResponse(メソッド = NLST。)
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。