我有一个 Web 项目(C# Asp.Net、EF 4、MS SQL 2008 和 IIS 7),我需要将其迁移到本地 IIS 7(目前与 CASSINI 配合良好)。
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 上运行,它们工作没有问题(但它们不使用实体框架)。
使用事件记录器我看到如下错误:
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 APPPOOL\ASP.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)
相关问题 https://stackoverflow.com/questions/7697867/passing-from-cassini-to-iis-7
更新:
您可以在有关此问题的资源中阅读,必须手动授予 MS SQL 2008 上的权限,正如 arift 在他的回答中所解释的那样。
使用 IIS 7.5 和 MS SQL 2008 R2,无需手动设置权限。