【问题标题】:Issue with SQL Server FileStreamSQL Server FileStream 的问题
【发布时间】:2013-01-31 15:27:55
【问题描述】:

我们目前正在审查我们在其中一个实时环境中遇到的问题,其中 OpenFileStream(SqlFileStream C# 类中的私有方法)

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);
                    }

我们查看了端口/防火墙,甚至发现它是 NtCreateFile 在 .Net 源代码中失败(值为 3221225530),但我找不到有关该值或值的文档返回形式IOStatusBlock,它是返回参数之一。

\\v02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593\dbFileStore\dbo\tblFile\DataFile\AC50B769-B6F8-43AA-B266-E4E837D78BA0\VolumeHint-HarddiskDmVolumes\\SQLData

还有什么其他人可以建议看的吗,我和我的团队已经在这两天的大部分时间里一直在研究这个。

干杯, J

【问题讨论】:

    标签: sql sql-server-2008-r2 win32exception


    【解决方案1】:

    虽然已经过去了这么多时间,但我们使用 SQL Server 2012 的 ReadWrite 遇到了这个问题。 Read 没有问题,Write 没有问题,但只有 ReadWrite。

    在安装/卸载 SQL Server 更新期间似乎发生了一些事情 - 注册表设置被安装程序意外删除。使用 .reg 文件读取它:

     Windows Registry Editor Version 5.00
    
     [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\FsctlAllowlist]
     "FSCTL_SQL_FILESTREAM_FETCH_OLD_CONTENT"=dword:00092560
    

    【讨论】:

    • 感谢您的支持,因为我知道诊断有多么困难! :) 没有 VSF 的新硬盘似乎可以为我们排序。也就是说我不知道​​他们是否还有任何问题,因为我现在离开了公司。
    【解决方案2】:

    发现是 Veritas Storage Foundation 无法使用 SQL FileStream,似乎在执行 Windows API 调用时 VSF 存在一些问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-16
      • 2011-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多