2013-01-31 81 views
0

我們目前正在審查我們在那裏OpenFileStream(SqlFileStream C#類的內部私有方法)問題與SQL Server的FileStream

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的淨源代碼中沒有(用3221225530的值)但我無法找到什麼值或返回值的文檔IOStatusBlock這是返回參數之一。

\\ V02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593 \ dbFileStore \ DBO \ tblFile \數據文件\ AC50B769-B6F8-43AA-B266-E4E837D78BA0 \ VolumeHint-HarddiskDmVolumes \\ SQLDATA

有什麼人其他人可能會建議看看,我和我的團隊一直在尋找這兩天的最佳時間。

乾杯, Ĵ

回答

0

算出來那是未用SQL的FileStream工作的Veritas Storage Foundation,似乎存在執行Windows API調用時有點問題與VSF。

1

雖然這麼多時間過去了,但我們在SQL Server 2012中遇到了ReadWrite問題。讀取沒有問題,寫入沒有問題,但只有使用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 
+0

感謝您爲此我已upvoted,因爲我知道這是診斷有多困難! :)沒有VSF的新硬盤似乎爲我們分類。這就是說,我不知道我現在離開公司還有什麼問題。 – Jamie