Sql Server 2012 Local DB發布到伺服器端後無法訪問

來源:互聯網
上載者:User

標籤:

項目背景

基於Windows認證的Web application, 通過Visual Studio 2013建立的LocalDB位於App_Data目錄下

現象

本地調試沒有任何問題。發布到伺服器(Windows Server 2008R2, IIS7.5)後,在瀏覽器訪問拋出異常 A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details. 

原因

LocalDB基於使用者模式運行,而IIS預設使用服務帳戶,因此失去了對localDB的訪問權。

解決辦法

在IIS中開啟對應的Web應用池屬性,設定Identity為特定的域使用者,並將Load User Profile的值設為True,程式恢複正常運行

Sql Server 2012 Local DB發布到伺服器端後無法訪問

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.