我剛剛在ASP.Net MVC 4中部署了一個新應用程序。我使用SQL Server 2008 R2( NOT SQL Express)。MVC 4中的SQL Server Express數據庫文件自動創建錯誤 - 但我不想使用SQL Server Express
它在前10分鐘運行良好,然後我在代碼中做了一些更改並重新部署。
現在,每當我嘗試訪問使用SimpleMembership一個頁面,我得到這個錯誤:
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: 26 - Error Locating Server/Instance Specified)
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.
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
但是,我做不使用SQL Server Express。在我web.config
我已經設置所有連接字符串如下:
<add name="ApplicationServices"
connectionString="Server=myServer;Database=myDB;User Id=myUserID;Password=myPWD;"
providerName="System.Data.SqlClient" />
<add name="ApplicationServices"
connectionString="Server=myServer;Database=myDB;User Id=myUserID;Password=myPWD;"
providerName="System.Data.SqlClient" />
爲什麼它一直試圖創建一個SQL Server EXPRESS數據庫?
連接字符串名稱需要與數據庫上下文相同。請參閱http://stackoverflow.com/questions/5346926/code-first-specify-database-name – AaronLS 2013-04-08 22:21:41
對不起,我可能誤解了你的問題。我假設你先使用EF代碼。 – AaronLS 2013-04-08 22:25:21
你解決了這個問題嗎?我面對完全相同的錯誤.. – Chatumbabub 2013-05-22 18:08:10