Open the website today, suddenly reported this error, usually good
cannot open database "JMECC" requested by the login. The login failed.
Login failed for user ' NT authority\iusr '.
My connection string is this, with Windows Authentication logon:
Data source=.\sqlexpress;initial catalog=jmecc;integrated security=true;multipleactiveresultsets=true;application Name=entityframework
think of a recent just modified a Web. config configuration, that is, add the following sentence in Web. config, which is used to impersonate the IIS authentication account, if no user name is specified, it is used by default NT authority\iusr
<identity impersonate= "true"/>
Because the user has insufficient permissions to log on to the specified database, Windows authentication fails with three solutions:
1. You can change the connection string to user name (SA) and password login, if there is no permission to operate the server recommend this scheme;
2. Or comment out this sentence from within the system.web, but may affect other functions, such as file operation;
3. Open SQL Server Management Studio, Security-Logins, right-click New login .... login name to enter NT AUTHORITY\IUSR -OK
On the new user NT authority\iusr, right-click Properties----Server Roles Select public and sysadmin---user Mapping Select your database in the Default S Chema column fill in the dbo--OK!
(I do not know why this editor can not upload pictures, so no)
SQL Server user ' NT authority\iusr ' logon failed