Entity framework 4 如何使EF代码首先在“IIS AppPool\MySiteName”下工作?

Entity framework 4 如何使EF代码首先在“IIS AppPool\MySiteName”下工作?,entity-framework-4,Entity Framework 4,我正在asp.net网站上学习MVC3 我的MVC 3应用程序已经在IIS AppPool\MySiteName下进行了测试,运行良好 使用Sql Server Management Studio,我为IIS AppPool\MySiteName创建了一个新帐户 我遵循了本教程,发现了如下错误: Server Error in '/' Application. --------------------------------------------------------------------

我正在asp.net网站上学习MVC3

我的MVC 3应用程序已经在IIS AppPool\MySiteName下进行了测试,运行良好

使用Sql Server Management Studio,我为
IIS AppPool\MySiteName
创建了一个新帐户

我遵循了本教程,发现了如下错误:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Cannot open database "Movies" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\Getting Started'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

该错误表示用户IIS APPPOOL\Getting Started没有正确的登录凭据,或者您的用户名或密码不正确。为什么不向我们展示一下web.config文件中的连接字符串是什么样的呢

  • 创建并配置新的应用程序池, 比如说AppPoolFoo,在 本地用户帐户的标识, 说User1
  • 在IIS中配置要运行的站点 在AppPoolFoo下
  • 授予用户1适当的权限 SQL Server管理工作室

  • 我不清楚您是否遵循了这些步骤,或者是否有不同的场景。

    在应用程序池
    GettingStarted
    上将
    加载用户配置文件设置为
    True

    @xport:您是如何在SQL Server中创建帐户/登录名的?我终于意识到您运行的是一个应用程序Poool identity“virtual”帐户,本文可能会有所帮助:在应用程序池上设置
    Load User Profile=True
    。完成!以下是一个优秀的教程: