2017-01-21 13 views
-1

私は、同じサーバー上で複数のWebアプリケーションを実行しています。すべてMVCです。Asp.net MVC接続

新しいAsp.Net MVCアプリケーションを作成し、サーバーに配置しました。接続文字列の値を変更したところ、次のエラーがスローされます。私はこれで困っている。 SQL Serverはリモート接続を許可するように設定されています。接続文字列は、正しい名前付きインスタンスを参照します。開始するには

- -

これは以下のweb.configファイルに

<connectionStrings> 
    <add name="RAD_SystemEntities" connectionString="metadata=res://*/Models.RADSystem.csdl|res://*/Models.RADSystem.ssdl|res://*/Models.RADSystem.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ServerName\NAMED_INSTANCE;Initial Catalog=RAD_System;Integrated Security=False;Persist Security Info=False;User ID=sa;Password=sa&quot;" providerName="System.Data.EntityClient" /> 
</connectionStrings> 

私の接続文字列では、あなたの問題は、データベースにあるエラー

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.

Exception Details: System.Exception: 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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[Exception: 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)]
TotalDesk.Controllers.HomeController.Index(User model) +7147
lambda_method(Closure , ControllerBase , Object[]) +104
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary 2 parameters) +181
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.b__41() +28 System.Web.Mvc.Async.<>c__DisplayClass8 1.<BeginSynchronous>b__7(IAsyncResult _) +10 System.Web.Mvc.Async.WrappedAsyncResult 1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.<>c__DisplayClass39.b__33() +58 System.Web.Mvc.Async.<>c__DisplayClass4f.b__49() +225 System.Web.Mvc.Async.<>c__DisplayClass37.b__36(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult 1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +99 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +50 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.<>c__DisplayClass1d.b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult 1.End() +55
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39 System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult
1.End() +55
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9667432 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

+0

フォーマットを支援していただきありがとうございます。 – Orion

+0

実際の接続文字列ですか?それは二倍に見えます。 – Jasen

+0

これはVisual Studioから生成された方法です。私は、プロジェクト全体をサーバーにコピーし、ユーザー名とパスワードのみを変更しました。私のローカルコピーでは正常に動作します。 – Orion

答えて

0

私の問題は、私はGACにあったものに私のプロジェクトでinccorect Entity Frameworkのを持っていたことでした。 Entity FrameworkのバージョンがGACのバージョンと同じに変更され、問題が解決されました。

同じことをしている場合。設定ファイルの参照を正しいバージョンに更新してください。

0

である4つの問題があります可能性があります。共通 LocalDb SqlExpress Sqlサーバーの接続エラーSQL Network Interfaces, error: 50 - Local Database Runtime error occurred、あなたはあなたの

私は、以下を行うことが最も簡単であることを発見しました。写真と手順を添付しました。

最初にインストールしている場合確認し、あなたはあなたができる、このステップが失敗した場合、CMDに

  1. cmd> Sqllocaldb.exe i
  2. cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore" を実行して、レジストリをチェックすることによってこれを行うことができますオプションdで削除コマンド> Sqllocaldb.exe D "someDb"
  3. cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"
  4. cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"

SqlLOCALDb_edited.png

+0

どうもありがとうございました。遅く返事をして申し訳ありません。私は私の側にものを固定することに圧倒されています。私は問題がEntity Frameworkのバージョンであることを発見しました。 GACのプロジェクトと互換性のないバージョンがありました。 – Orion

関連する問題