天天看點

使用者 'IIS APPPOOL\xxxx' 登入失敗

一、現象

釋出到iis後,網站出現以下提示

<code>異常詳細資訊: System.Data.SqlClient.SqlException: 使用者</code><code>'IIS APPPOOL\IdealTest'</code> <code>登入失敗。</code>

二、分析原因

1.檢視項目web.config檔案中的資料庫連接配接字元串:<code>Integrated Security=True;</code><code><code> </code></code>

2.打開iis,檢視應用程式池,使用了內建驗證模式,其辨別為ApplicationPoolIdentity,導緻了連接配接資料庫出錯

三、解決方法

1.修改SQLServer的連接配接字元串,使用資料庫帳号密碼登入

server=localhost;uid=sa;pwd=xxxx;database=master;

2.IIS管理器=&gt;應用程式池=&gt;網站對應的程式池=&gt;進階設定—》辨別—》将程序模型下的 ApplicationPoolIdentity 改為 localSystem