问题描述
我有一个 Web 项目(C# Asp.Net、EF 4、MS SQL 2008 和 IIS 7),我需要在本地将其迁移到 IIS 7(目前与 CASSINI 配合得很好).
I have a web project (C# Asp.Net, EF 4, MS SQL 2008 and IIS 7) and I need to migrate it to IIS 7 locally (at the moment works fine with CASSINI).
在 IIS 中本地我有我的 Default Web Site
与我的部署.我的部署和 Default Web Site
都位于池 ASP.NET v4.0(查看图像以获取设置)上,池目标 Framework 4 作为我的 Web 项目.访问该站点时,浏览器不显示该页面,而是允许浏览器下载该页面.
Locally in IIS I have my Default Web Site
with my deploy. Both my deploy and Default Web Site
are on pool ASP.NET v4.0 (look image for settings) the pool target Framework 4 as my web project.
When visiting the site, the browser does not show the page and allow the browser to download the page instead.
我有其他项目在本地运行在 IIS 上,它们可以正常工作(但它们不使用实体框架).
I have other projects running on IIS locally and they work with no problems (but they do not use Entity Framework).
使用事件记录器我看到如下错误:
Using the Event Logger I see errors as below:
Exception information:
Exception type: EntityException
Exception message: The underlying provider failed on Open.
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
Login failed for user 'IIS APPPOOLASP.NET v4.0'.
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
相关问题
更新:您可以在有关此问题的资源中阅读,必须在 MS SQL 2008 上手动授予权限,如 arift 在他的回答中解释的那样.使用 IIS 7.5 和 MS SQL 2008 R2,不需要手动设置权限.
UPDATE: You can read in the resources on this question that permissions must be granted on MS SQL 2008 manually as arift explain in his answer. Using IIS 7.5 and MS SQL 2008 R2, setting manually permission should not be necessary.
推荐答案
您可以从 IIS7 -> 应用程序池 -> 高级设置更改 ApplicationPoolIdentity.
You can change the ApplicationPoolIdentity from IIS7 -> Application Pools -> Advanced Settings.
在 ApplicationPoolIdentity 下,您将找到本地系统.这将使您的应用程序在 NT AUTHORITYSYSTEM
下运行,默认情况下这是数据库的现有登录名.
Under ApplicationPoolIdentity you will find local system. This will make your application run under NT AUTHORITYSYSTEM
, which is an existing login for the database by default.
在应用此建议之前,您应该注意并了解安全隐患.
这篇关于用户 'IIS APPPOOLASP.NET v4.0' 登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!