为什么没有出现在App_Data文件夹mdf文件? [英] Why is mdf file not appearing in the App_Data folder?

查看:2360
本文介绍了为什么没有出现在App_Data文件夹mdf文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是想上手开始ASP.NET MVC 4。

I've being trying to get started with Beginning ASP.NET MVC 4.

和打了一个问题马上,根据电子书我应该能够启动一个新的MVC 4互联网应用,调试和选择登录表格的UI tempate,然后停止。
这应该创建一个在App_Data文件夹中的MDF文件。我应该能够单击服务器资源管理器上,并打开。

And hit a problem straight away, according to the e-book I should be able to start a new mvc 4 internet application, debug and select log-in form the UI tempate, then stop. This should create the mdf file in the App_Data folder. Which I should be able to click on and open in Server Explorer.

什么实际发生的情况 - 数据库得到我的SQL防爆preSS创建

What actually happens - Database get created in my SQL Express.

获得这一步正确的是下面的教程的其余部分是至关重要的。

Getting this step correct is crucial to following the rest of the tutorial.

我所熟悉的MVC,但主要是前端的东西,所以我想提高我的MVC的数据库/模型边的理解。

I am familiar with MVC , but mainly the front end stuff, so I'm trying to increase my understanding of the database/models side of MVC.

这是一个全新的项目,未进行任何更改,只需开箱code的。
在Windows XP的机器,使用Visual Studio 2010。

This is a completely new project, no changes were made, just out of the box code. On a windows XP machine, using Visual Studio 2010.

的connectionString -

Connectionstring -

  <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-HaveYouSeenMe-20131125091100;Integrated Security=SSPI" providerName="System.Data.SqlClient" />

任何人都可以请解释 - 为什么我的开箱即用的ConnectionString的是SQL防爆preSS创建数据库,以及如何在App_Data文件夹中创建的中密度纤维板为书建议。欢呼声。

Can anyone please explain - why my out of the box connectionstring is creating the Db in SQL Express and how to create the mdf in the App_Data folder as book suggests. cheers.

推荐答案

只要改变你的连接字符串:

Just change your connection string:

<add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\aspnet-HaveYouSeenMe-20131125091100.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

| DataDirectory目录| 是指向您的应用程序的〜/ App_Data文件文件夹中的特殊标记。

The |DataDirectory| is a special token which is pointing to the ~/App_Data folder of your application.

结帐的 下面在MSDN上的文章 提供更多细节在SQLEx preSS连接字符串。

Checkout the following article on MSDN which provides more details about connection strings in SQLExpress.

这篇关于为什么没有出现在App_Data文件夹mdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆