2016年2月1日 星期一

【MS-SQL】An attempt to attach an auto-named database for file ... failed.

EF 嘗試存直接附屬於專案的 mdf 時發生的 inner exception

An attempt to attach an auto-named database for file
D:\\...\\xxx.mdf failed.
A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

錯誤似乎是我不複製 mdf 到輸出、建 edmx 時又沒設定修改連接之類的選項所以相對目錄抓不到(之類的)。

Anyway,現階段是是到 App.config 裡修改 connectionString 為絕對路徑先解決,有時間再來研究做直屬專案 mdf 還有連 EF 的設定是不是有什麼問題。

ref: sof

沒有留言:

張貼留言