sqlsql-server-2008-r2win32exception

Issue with SQL Server FileStream


We are currently reviewing an issue we have on one of our live environments where OpenFileStream (private method inside SqlFileStream C# class)

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)

We have this working on another environment with no issues. The code we are using to call is as follows:

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

We've looked at ports/firewalls and even got to the point of seeing it is NtCreateFile failing inside the .Net Source code (with a value of 3221225530) but I can't find documentation on what that value or the value returned form IOStatusBlock which is one of the return parameters.

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

Is there anything anybody else could suggest to look at, me and my team have been looking at this for best part of two days.

Cheers, J


Solution

  • Worked out that it was Veritas Storage Foundation which wasn't working with SQL FileStream, seems there is a bit of issue with VSF when performing Windows API calls.