简体   繁体   中英

Visual Studio 2013 not creating database when I select the authentication option

I tried this on two different computers but get the same issue.

I am using the latest and greatest visual studio 2013. I create a new project (of type Web->Asp.Net application) Choose a template type of MVC or Web API (have same issue whatever type of template I select).

Then I change the authentication type to use individual. 在此处输入图片说明

The project with all the authentication code is created. Web.config has the connection string set for a .mdf file.

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20131031102303.mdf;Initial Catalog=aspnet-WebApplication1-20131031102303;Integrated Security=True" providerName="System.Data.SqlClient" />

But the mdf file is missing in the app data folder. I searched the whole computer for the mdf file, but it is not created anywhere. As a result testing my sign in and register modules using a browser gives me the Yellow Screen Of Death with the db connection being the issue. What am I missing here?

应该在

C:\Users\[*yourusername*]\Documents\Visual Studio 2013\Projects\WebApplication2\App_Data

This is not a real answer to my question as to why this is happening. But here is the workaround I did to make it happen. I downloaded one of their sample projects which did have the mdf file in the app_data folder. Then I got the table schema from that mdf file and created those tables in my SQL Server database. Then I changed my connection string to point to my SQL Server database. My authentication pages worked after that with this new database. But what a pain to go through.

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