【发布时间】:2014-03-18 22:24:19
【问题描述】:
我在 VS2012 上启动了一个 MVC 项目,创建了我的模型、控制器和视图。我首先使用实体框架代码,所以我启用了迁移,并且我正在根据代码中的更改更新数据库。 页面运行正常,数据库正常工作,数据正在按应有的方式检索,所以从功能上来说,一切都很好。
问题是我在 web.config 中看不到连接字符串:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301880
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
数据库也没有显示在 SQL Server 对象资源管理器中... 我已经检查了this answer,但我的对象资源管理器上的服务器已经是正确的。
【问题讨论】:
标签: c# asp.net asp.net-mvc entity-framework ef-code-first