vnetで問題が発生する可能性があります.SQL-Serverへの接続を開くことができますが、WPFアプリケーションで接続しようとすると、 :データベースへのアプリケーション接続に失敗しましたが、Visual Studioで動作します
System.Data.SqlClient.SqlException occurred HResult=0x80131904
Message=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: 25 - Connection string is not valid)
失敗した接続試行コード:同じコンピュータ上のVisual Studioを介して接続したときに
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = "Data Source=xxx;Initial Catalog=xxx;User ID=xxx;Password=xxx;";
myConnection.Open();
だから、これは正常に動作しますが、アプリケーションに障害が発生しました。
アイデア?
を確認していない場合は、代替可能な接続文字列
を試すことができますは、Visual Studioから接続ダイアログ・ページのスクリーンショットを投稿できますか? –
SQL Serverと関連してアプリケーションはどこにありますか? –
画面が追加されました。アプリケーションはローカルで、SQL Serverはサーバー上にあり、vpn inbetweenです。接続はvnetで動作しますが、実行中のアプリケーションでは動作しません。 – Vide