2017-10-10 105 views
0

我正在按照教程和使用SQL Server Management Studio部署从Visual Studio到IIS的项目。每当我尝试通过键入“http://localhost:84/”(因为它是配置的端口)来打开项目时,我收到错误消息:如何跟踪IIS应用程序中的数据库登录?

Server Error in '/' Application.

Cannot open database "MyIMDB" requested by the login. The login failed. Login failed for user 'PC19\MyIMDBUser'.

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.

Exception Details: System.Data.SqlClient.SqlException: Cannot open database "MyIMDB" requested by the login. The login failed. Login failed for user 'PC19\MyIMDBUser'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

我已经做了什么是

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

我创建的用户提出的是PC19 \ MyIMDBUser

还有其他什么方式可以跟踪数据库中一步一步发生的事情吗?比如,看看它何时尝试登录,它使用什么用户,密码等等。像Visual Studio的断点可能吗?任何可以收集更多关于正在发生的事情的信息以及项目为什么这样做?

+0

您的应用程序使用的是Windows凭据验证到数据库,可能是IIS本地用户帐户下运行。您可以将应用程序的身份验证更改为需要Windows凭据,并将其传递到数据库或使用数据库登录并编辑连接字符串accordl。顺便说一句,这很可能已经回答了。 – bradbury9

+0

[Login for users'IIS APPPOOL \ ASP.NET v4.0'失败]的可能重复](https://stackoverflow.com/questions/7698286/login-failed-for-user-iis-apppool-asp-net- v4-0) – bradbury9

+0

*有一个名为'CORP \ PC19 $'的账户。它是'PC19's *电脑*帐户。一个域中的计算机拥有与用户一样多的帐户。 –

回答

0

进入IIS - >应用程序池,并改变用户身份

enter image description here

+0

有几个选择,设置一个特定的帐户,然后改变身份验证和传递到数据库,使用连接字符串中的数据库登录... – bradbury9

+0

我做到了,现在它试图登录正确的用户,但仍然无法登录。它显示“无法打开数据库”MyIMDB“登录请求登录失败 用户'PC19 \ MyIMDBUser'登录失败。” –

+0

当你的用户很可能没有数据库的访问权限。你可以连接到数据库使用您的Windows凭据? –