asp.net - 如何使用 localDB 将 ASP.NET MVC 4 应用程序部署到 Windows 7 上的本地 IIS?

标签 asp.net .net iis windows-7 localdb

当我尝试在带有 Visual Studio 2013 的 Windows 7 上使用本地 IIS 运行我的 ASP.NET MVC 4 应用程序时。当应用程序尝试连接到 localDB\v11.0 时遇到以下错误

Server Error in '/' Application.

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. )

The 2 event logs are

Unexpected error occurred while trying to access the LocalDB instance registry configuration. See the Windows Application event log for error details.

and

Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.



我在网上找到的大多数解决方案都引用了这篇文章:http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

我在描述的情况和我的情况之间看到的唯一区别是描述的错误代码是 0,而我的错误代码是 50。但是,建议的解决方案对我不起作用。

即使我将 modify setProfileEnvironment 设置为 true,我也无法克服这个错误,并且我已经花费了数小时来处理不同的 processModel 参数和应用程序池。

最佳答案

我也遇到了同样的问题,但有一个解决方案。

转到 IIS 服务器,然后转到运行应用程序的应用程序池。在应用程序池的高级设置中有一个“进程模型”选项,在该选项下有一个“身份”选项。默认情况下,这是应用程序池标识。将其更改为本地系统,您就完成了。

并记住将 App_Data 文件夹放在 IIS 服务器的 WWW 文件夹中

关于asp.net - 如何使用 localDB 将 ASP.NET MVC 4 应用程序部署到 Windows 7 上的本地 IIS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22737373/

相关文章:

c# - 为什么我的静态类没有在 ASP.NET MVC 中初始化?

c# - 即使 DropDownList 已禁用其 View ,SelectedValue 仍应返回一个值

javascript getelementbyid 不工作,因为 id 改变了

c# - sql表适配器和 Entity Framework 模型有什么区别?

c# - 单元测试asp.net mvc restful routing FormatResult

c# - 将 console.writeline 从 Windows 应用程序重定向到字符串

jquery - 发送邮件而不回发

c# - 将小数四舍五入到第一个不为零的小数位

.net - 无法修复错误 : This configuration section cannot be used at this path

基于主机名的 Azure Web Apps 反向代理