简体   繁体   中英

mdf file not visible in App_Data folder, Microsoft Visual Studio Ultimate 2013

I am new to Web Development in ASP .NET using Microsoft Visual Studio. I am trying to set up my database following an online tutorial which uses the Code First technique of Entity Framework to define the database.

I have creating the classes in the Models Folder.

I edited the Web.config file as follows:

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data
Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WingtipToys-
20131119102907.mdf;Initial Catalog=aspnet-WingtipToys-20131119102907;Integrated
Security=True" 
  providerName="System.Data.SqlClient" />
<add name="OddJobs"
     connectionString="Data 
Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\oddjobs.mdf;Integra
ted Security=True" providerName="System.Data.SqlClient" /> 
  </connectionStrings> 

OddJobs is the name of my application. I haven't edited anything in the first add tag. I have put in 'OddJobs' in the second tag wherever necessary. The application builds successfully. However, I cannot view my .mdf file after debugging the application. I have tried refreshing the App_Data folder and 'showing all files'. Please help.

Try changing the db version from (LocalDB)\\v11.0; to (LocalDB)\\MSSQLLocalDB; . It worked for me on Visual 2017.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM