[英]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
[英]The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured
運行應用程序時出現以下錯誤消息。
我進行了搜索並嘗試了不同的解決方案。
我打開了SQL Server配置管理器,SQL Server網絡配置, SQLEXPRESS
協議,右鍵單擊“ TCP / IP”,“ IP地址”選項卡,並將TCP端口更改為1433。沒有用。
在services.msc
,SQL Server進程( SQLEXPRESS
)狀態正在運行。
請尋求幫助。
謝謝。
您可以檢查連接字符串中的問題。 可能是服務器名或您使用的數據庫可能不正確。
實體框架的連接字符串(我希望您根據屏幕截圖使用它)必須采用以下格式。
<add name="<keyname>"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
database=YourDatabaseName;
AttachDBFilename=|DataDirectory|<dbname>.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.