将MVC项目部署到localhost

问题描述:

没有人知道有关如何将使用实体框架工作的mvc项目部署到localhost的任何教程.我在asp.net网站上观看了由multiplesight制作的视频教程,但是部署似乎与数据库优先而不是代码优先有所不同.

我的主要问题是.

1.我应该在哪里放置数据库?
2.我需要对以下连接字符串进行哪些更改

Does anyone know any tutorials on how to deploy a mvc project that uses entity framwork to localhost. I watched the video tutorial made by pluralsight on asp.net web site, but the deployment seems to different with database first rather than code first.

My main questions are.

1. Where do i place my database?
2. What changes do i need to make to the following connection string

<add name="DbEntities" connectionString="metadata=res://*/Models.DatabaseEntities.Model.csdl|res://*/Models.DatabaseEntities.Model.ssdl|res://*/Models.DatabaseEntities.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=C:\Databases\MyDb.mdf;integrated security=True;connect timeout=30;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

通过附加mdf文件在sql server中创建数据库.将数据库名称替换为"your_db_name"

Create you database in sql server by attaching mdf file. replace your database name with "your_db_name"

<add name="DbEntities" connectionString="metadata=res://*/Models.DatabaseEntities.Model.csdl|res://*/Models.DatabaseEntities.Model.ssdl|res://*/Models.DatabaseEntities.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=localhost;Initial Catalog=your_db_name;Integrated Security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />