Login failed for user 'IIS APPPOOL\myAppPool

前端 未结 5 1061
花落未央
花落未央 2020-12-06 00:32

I having the following error message:

Cannot open database \"SmallBakery\" requested by the login. The login failed. Login failed for user \'IIS APPPO

相关标签:
5条回答
  • 2020-12-06 00:44

    Like others said so far you need to take your app pool system user (IIS AppPool\myapppool) and add it as database user for that database with appropriate permissions.

    Note that this will work just find on your IIS/Server but if you plan on migrating application to a different IIS/Sql server it will require changes in both SQL Server and IIS. I’d suggest you also consider sql server authentication – it may be more convenient for your specific case.

    0 讨论(0)
  • 2020-12-06 00:44

    In my case these steps lead me to successfully handle this error.Hope it will help you also

    0 讨论(0)
  • 2020-12-06 00:45

    It depends on how you want to authenticate in your app. Are you trying to use impersonation in your app?

    What's happening right now is the identity of your app pool in IIS is getting passed when trying to access the database. You can change the identity of your app pool to be something that has access to the database or you could change your connection string to use a specific login instead of integrated security.

    0 讨论(0)
  • 2020-12-06 00:52

    If you don't change, each app pool has it's own identity. In your case, just add a new user to your database SmallBakery with the name IIS APPPOOL\MyAppPool using SQL Management Studio. You find the users list in the "Security/Users" subnode of your database. This should look something like that:

    enter image description here

    For testing, let the user be member of the db_owner role. If that works, remove this role and just let it be member of db_datareader and db_datawriter.

    This way, each app pool (perhaps each website, if they all use their own app pool) only has access to the corresponding database.

    0 讨论(0)
  • 2020-12-06 00:58

    Check this post out. Your problem sounds similar to one I was running into, with the same exact error message.

    http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-2-instance-ownership.aspx

    0 讨论(0)
提交回复
热议问题