被激活,我在一個典型的應用WPF
使用本地數據庫。我試圖運行調試,但它沒有工作,給了我以下錯誤:
:
了SQL-Server服務在本地應用
<2016-11-23T17:59:19.1888435+03:30 The underlying provider failed on Open. at System.Data.Entity.Core.EntityClient.EntityConnection.Open() at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func 1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess) at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass47 1.<ExecuteFunction>b__45() at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func 1 operation) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ExecutionOptions executionOptions, ObjectParameter[] parameters) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, MergeOption mergeOption, ObjectParameter[] parameters) at System.Data.Entity.Core.Objects.ObjectContext.ExecuteFunction[TElement](String functionName, ObjectParameter[] parameters) at FirstAttemptForFillingOutTheContent.EngineEntities.SignIn(String mail, String password) in c:\Users\Media Depp\Documents\Visual Studio 2013\NewProjects\SeyyedAmir\FirstAttemptForFillingOutTheContent\FirstAttemptForFillingOutTheContent\EngineModel.Context.cs:line 61 at FirstAttemptForFillingOutTheContent.DataAccess.SearchUSerDA(String name, String pass) in c:\Users\Media Depp\Documents\Visual Studio 2013\NewProjects\SeyyedAmir\FirstAttemptForFillingOutTheContent\FirstAttemptForFillingOutTheContent\DataAccess.cs:line 140 EntityFramework 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
搜索我想通了,我OS
的數據庫服務處於非活動狀態後
我手動啓動它和程序工作正常。如果服務未激活,我如何在C#
代碼本身中激活服務。我看起來像this職位,但我需要一些C#
代碼來做到這一點。
看來你的sqlserver託管在本地機器上,有時服務可能無法啓動,由於像自動啓動的設置,不是enabled.some次你的筆記本電腦可能會重新啓動多次,我沒有看到一次SQL任何問題託管 – TheGameiswar
@TheGameiswar是的,有時服務不會自動啓動,在這種情況下,我的應用程序不能正常工作。我想從我自己的應用程序開始。我不明白你不明白哪一部分 – Media