如何使用 localDB 将 ASP.NET MVC 4 应用程序部署到 Windows 7 上的本地 IIS? [英] How to deploy ASP.NET MVC 4 application using localDB to local IIS on Windows 7?

查看:22
本文介绍了如何使用 localDB 将 ASP.NET MVC 4 应用程序部署到 Windows 7 上的本地 IIS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When I try to run my ASP.NET MVC 4 application using Local IIS on Windows 7 with Visual Studio 2013. I run into the following error when the application tries to connect to localDBv11.0

/"应用程序中的服务器错误.

Server Error in '/' Application.

发生与网络相关或特定于实例的错误建立与 SQL Server 的连接.服务器不是找到或无法访问.验证实例名称是否正确并且 SQL Server 配置为允许远程连接.(提供者:SQL 网络接口,错误:50 - 本地数据库运行时发生了错误.无法创建自动实例.看窗户错误详细信息的应用程序事件日志.)

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

2 个事件日志是

尝试访问 LocalDB 实例时发生意外错误注册表配置.请参阅 Windows 应用程序事件日志以了解错误详情.

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

无法获取本地应用程序数据路径.很可能是用户个人资料未加载.如果在 IIS 下执行 LocalDB,请确保已为当前用户启用配置文件加载.

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

Most solutions I found online references this post: http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx

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

The only difference I see between the described situation and my situation is that the described error code is 0 whereas my error code is 50. However, the proposed solution does not work for me.

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

I cannot get past this error even if I set modify setProfileEnvironment to true and I've spent hours of time playing around with different processModel parameters and application pools.

推荐答案

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

I was also suffering from same problem, but there is a solution for it.

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

Go to the IIS server, and then to the application pool from which your application is running. In the advanced settings of the application pool there is a "Process Model" option, under which there is an "Identity" option. This is by default the application pool identity. Change it to Local System, and you're done.

记得把App_Data文件夹放在IIS服务器的WWW文件夹中

这篇关于如何使用 localDB 将 ASP.NET MVC 4 应用程序部署到 Windows 7 上的本地 IIS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆