简体   繁体   English

在App_Data文件夹中看不到mdf文件,Microsoft Visual Studio Ultimate 2013

[英]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. 我是使用Microsoft Visual Studio的ASP .NET中的Web开发的新手。 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. 我正在尝试通过在线教程建立数据库,该教程使用Entity Framework的Code First技术定义数据库。

I have creating the classes in the Models Folder. 我已经在“模型”文件夹中创建了类。

I edited the Web.config file as follows: 我编辑了Web.config文件,如下所示:

<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. OddJobs是我的应用程序的名称。 I haven't edited anything in the first add tag. 我没有在第一个添加标签中进行任何编辑。 I have put in 'OddJobs' in the second tag wherever necessary. 如有必要,我已在第二个标签中添加了“ OddJobs”。 The application builds successfully. 该应用程序成功构建。 However, I cannot view my .mdf file after debugging the application. 但是,调试应用程序后,无法查看我的.mdf文件。 I have tried refreshing the App_Data folder and 'showing all files'. 我尝试刷新App_Data文件夹并“显示所有文件”。 Please help. 请帮忙。

Try changing the db version from (LocalDB)\\v11.0; 尝试从(LocalDB)\\v11.0;更改数据库版本(LocalDB)\\v11.0; to (LocalDB)\\MSSQLLocalDB; (LocalDB)\\MSSQLLocalDB; . It worked for me on Visual 2017. 它在Visual 2017上对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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