【问题标题】:Publishing ASP.NET MVC 4 SimpleMemebership database to IIS 8将 ASP.NET MVC 4 SimpleMemebership 数据库发布到 IIS 8
【发布时间】: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


    【解决方案1】:

    问题是 .mdf 文件已被复制,而它已经附加到我的开发机器上运行的 LocalDB 实例。

    停止我的本地 IISExpress 然后复制数据库解决了这个问题。

    我还遇到了一些 Anti Forgery Token 错误,这些错误通过生成机器密钥并将它们放入我的 web.config 中得到了解决。这个问题的答案可以在here找到。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-30
      • 2021-09-08
      • 1970-01-01
      • 2016-05-27
      • 1970-01-01
      • 2019-08-04
      • 1970-01-01
      • 2013-01-23
      相关资源
      最近更新 更多