Login failed for user 'IIS APPPOOL\ASP.NET v4.0'

后端 未结 30 4726
天命终不由人
天命终不由人 2020-11-22 15:52

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

Locally in IIS I ha

相关标签:
30条回答
  • 2020-11-22 16:12

    Another way of granting permission to the database for the user IIS APPPOOL\ASP.NET v4.0 is as follows.


    1. Add New User with User Name and Login name as IIS APPPOOL\ASP.NET v4.0 with your default schema.
    2. Go to Owner schema and Membership, Check db_datareader, db_datawriter
    0 讨论(0)
  • 2020-11-22 16:13

    I ran into the same problem testing ASP.NET Web API

    Developed Web.Host in Visual Studio 2013 Express Database created in SQL Server 2012 Express Executed test using built in IIS Express (working) Modified to use IIS Local (from properties page - web option) Ran test with Fiddler Received error - unable to open database for provider.... citing 'APPPOOL\DefaultAppPool'

    Solution that worked.

    In IIS

    Click on application pool 'DefaultAppPool' Set Identify = 'ApplicationPoolIdentity' Set .NET framework = v4.0 (even though my app was 4.5)

    In SQL Server Management Studio

    Right click on Security folder (under the SQL Server engine so applies to all tables) Right click on User and add 'IIS APPPOOL\DefaultAppPool' In securables on the 'Grant' column check the options you want to give. Regarding the above if you are a DBA you probably know and want to control what those options are. If you are like me a developer just wanted to test your WEB API service which happens to also access SQL Server through EF 6 in MVC style then just check off everything. :) Yes I know but it worked.

    0 讨论(0)
  • 2020-11-22 16:14

    If you have your connection string added in your web.config, make sure that "Integrated Security=false;" so it would use the id and password specified in the web.config.

    <connectionStrings>
        <add providerName="System.Data.SqlClient" name="MyDbContext" connectionString="Data Source=localhost,1433;Initial Catalog=MyDatabase;user id=MyUserName;Password=MyPassword;Trusted_Connection=true;Integrated Security=false;" />
    </connectionStrings>
    
    0 讨论(0)
  • 2020-11-22 16:14

    You can face this wrong in specific database which is created after SSMS update. Open SSMS and select your databases and open your required database then click Security--> Users--> and right click on Users and click again on 'New User' and add 'NT AUTHORITY\Authenticated Users' and save you work and go to your Form on Web/Desktop whatever do you. Enjoy....

    0 讨论(0)
  • 2020-11-22 16:14

    In case you add a new login, make sure that under server properties ( rightclick -> properties)/security, authentication mode is set to both sqlserver and windows not only windows.

    0 讨论(0)
  • 2020-11-22 16:19

    Thought I'd post this as an answer as it is relevant to the question and can answer it in some cases.

    That same message appears also if the database does not exist!

    Be sure your connection string has no misspellings, is pointing to the right server instance, etc.

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