【发布时间】:2014-01-17 21:56:36
【问题描述】:
过去 5 个小时,我试图加载我在本地开发机器上设置的 .mdf 数据库,在我的 Windows Server 2012 w/IIS 8 服务器上无济于事。
注意:我目前正试图让它在 LocalDB 上运行,但如果我可以让它在我的 SQLEXPRESS 实例上运行,那也很好(如果它更简单,可能会更受欢迎)。
我当前的错误:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
)
网站:.net 4.5, x86, using SimpleMembership
我已将我的 *.mdf 文件从我的开发项目复制到服务器上的 App_Data 文件夹。如果我在这里删除文件,它们会被创建,但会出现不同的错误。
applicationHost.config:
<add name="Dashboard" enable32BitAppOnWin64="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
Web.config:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Dashboard-20131112173402;Integrated Security=true;AttachDBFilename=|DataDirectory|\aspnet-Dashboard-20131112173402.mdf" providerName="System.Data.SqlClient" />
</connectionStrings>
全球.asax:
if (!WebSecurity.Initialized)
{
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", true);
}
IIS 应用程序池设置:
Name: Dashboard
.NET Framework Version: v4.0
Enable 32-Bit Application: True
Identity: ApplicationPoolIdentity
Load User Profile: True
已发布的网站目录权限:
Dashboard: Full Control
服务器:
-
.\SQlExpress已安装并运行 -
Microsoft SQL Server 2012 Express LocalDB已安装并正在运行
我错过了什么?
【问题讨论】:
标签: asp.net asp.net-mvc-4 iis web-config localdb