2017-10-10 100 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憑據? –