Reputation: 31
I am using Visual Studio 2012 on Windows 8.
I create a new [Empty Web Application], follow common code-first (new database) steps to use EF, which are:
But when I run that page, I get:
Directory lookup for the file "C:\Users\XUHAI\Documents\Visual Studio 2012\Projects\EF\EmptyWeb\App_Data\EmptyWeb.WebContext.mdf" failed with the operating system error 2.
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
While I create [Web Forms] or [MVC] project, and perform the same steps, everything goes fine.
Upvotes: 1
Views: 199
Reputation: 3090
Operating system error 2 is "File not found".
Make sure the directory "C:\Users\XUHAI\Documents\Visual Studio 2012\Projects\EF\EmptyWeb\App_Data" exists.
Check your connection string for errors.
Upvotes: 0