現在、OpenFileStream (SqlFileStream C# クラス内のプライベート メソッド) を使用しているライブ環境の 1 つで発生した問題を確認しています。
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the path specified at System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access)
これは別の環境で問題なく動作しています。呼び出しに使用しているコードは次のとおりです。
using (SqlCommand command = new SqlCommand(insertFileSql, conn, transaction))
{
string path = null;
byte[] context = null;
using (SqlDataReader reader = command.ExecuteReader())
{
reader.Read();
path = reader.GetString(reader.GetOrdinal("PathName"));
fileID = reader.GetGuid(reader.GetOrdinal("FileId"));
context = (byte[])reader[reader.GetOrdinal("Context")];
}
richTextBox1.AppendText(
string.Format("Path: {0}, FileID:{1}, content: {2}", path, fileID, Convert.ToString(context)));
using (SqlFileStream strm = new SqlFileStream(path, context, FileAccess.ReadWrite))
{
// copy the user file to the Filestream
inputFileStream.CopyTo(strm);
}
ポート/ファイアウォールを調べたところ、.Net ソース コード内で NtCreateFile が失敗していることがわかりました (値は 3221225530) が、その値またはIOStatusBlock から返された値に関するドキュメントが見つかりません。これは戻りパラメータの 1 つです。
\\v02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593\dbFileStore\dbo\tblFile\DataFile\AC50B769-B6F8-43AA-B266-E4E837D78BA0\VolumeHint-HarddiskDmVolumes\\SQLData
他に何か提案できるものはありますか?
乾杯、J