c# - MVC4 发布的应用程序帐户登录页面未加载

标签 c# sql sql-server asp.net-mvc-4 iis-8

我已经使用标准 Internet 应用程序模板创建了一个 MVC 4 应用程序。 我已经添加了一些其他 Controller 、 View 、模型和到我自己的正常工作的 sql 数据库的连接。

当我将此发布到文件位置以通过我的 Windows 2012 服务器上的 IIS8 访问时,应用程序可以正常工作,但我单击登录或注册链接时除外。

我没有对应用程序的注册或登录部分进行任何更改,因此帐户 Controller 和模型与 webconfig 文件中的 DefaultConnection 字符串保持相同,见下文

enter <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-mvcdev-20131010105728;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-mvcdev-20131010105728.mdf" providerName="System.Data.SqlClient" />

我有几个注册成员(member),并且有一些 View 和 Controller 需要授权用户才能正确运行。

当我尝试访问帐户/登录或帐户/注册时出现的错误是:-

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

2个事件日志是

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

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.

有没有其他人遇到过这个问题或有任何指向一些有用解决方案的链接?

该应用程序已发布到我的 Windows 服务器的公共(public)文档中的一个文件夹中,当前正在同一 LAN 上的机器上访问

最佳答案

我也遇到了同样的问题,但是解决方案太小了 只需进入 iis 服务器,而不是运行应用程序的应用程序池,并提前设置应用程序池,我们将获得 Process Model 选项,在该选项下有身份,默认情况下是应用程序池身份,只需将其更改为本地系统和您的完成

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

关于c# - MVC4 发布的应用程序帐户登录页面未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19311331/

相关文章:

c# - 使用 C# Forms 应用程序静默安装 SQL Server

sql - 查询表按记录数最多排序

sql-server - 使用具有滚动总和的 SQL Over 语句

sql-server - 导入模块 : The specified module 'SqlServer' was not loaded because no valid module file was found in any module directory

c# - 为什么 `null` Nullable<T> 有哈希码?

c# - 委托(delegate)创建缓慢

c# - 无法从另一个线程访问对象

c# - 'async' 调用图中的最后一次调用是否需要同步?

sql - 使用 T_SQL 将行注入(inject)查询结果

sql - 选择具有最高 ID 和指定列值的行