w*s 发帖数: 7227 | 1 my DB is in the local pc, some times my program gave such errors, while most
of the time is ok.
any suggestions ?
Unhandled Exception: System.Data.EntityException: The underlying provider
failed
on Open. ---> System.Data.SqlClient.SqlException: A network-related or
instance
-specific error occurred while establishing a connection to SQL Server. The
serv
er 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 N
etwork Interfaces, error: 50 - Local Database Runtime error occurred. Error
occu
rred during LocalDB instance startup: SQL Server process failed to start.
)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception
, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(
TdsParserStateObj
ect stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,
SqlInternal
ConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire,
Bool
ean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean
withFa
ilover)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(
ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
ignoreSn
iOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(
ServerInfo
serverInfo, String newPassword, SecureString newSecurePassword, Boolean
redirect
edUserInstance, SqlConnectionString connectionOptions, SqlCredential
credential,
TimeoutTimer timeout)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(
TimeoutTime
r timeout, SqlConnectionString connectionOptions, SqlCredential credential,
Stri
ng newPassword, SecureString newSecurePassword, Boolean
redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(
DbConnectionPoolIdent
ity identity, SqlConnectionString connectionOptions, SqlCredential
credential, O
bject providerInfo, String newPassword, SecureString newSecurePassword,
Boolean
redirectedUserInstance, SqlConnectionString userConnectionOptions,
SessionData r
econnectSessionData)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(
DbConnectionOp
tions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo,
DbConn
ectionPool pool, DbConnection owningConnection, DbConnectionOptions
userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(
DbConn
ectionPool pool, DbConnection owningObject, DbConnectionOptions options,
DbConne
ctionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection
owning
Object, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(
DbConnection o
wningObject, DbConnectionOptions userOptions, DbConnectionInternal
oldConnection
)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(
DbConnection ow
ningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate,
Boolean o
nlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal
& co
nnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(
DbConnection ow
ningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions,
DbCon
nectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(
DbConnection
owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions
userOptions
, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.
TryOpenConnectionInternal(Db
Connection outerConnection, DbConnectionFactory connectionFactory,
TaskCompletio
nSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(
DbConnection
outerConnection, DbConnectionFactory connectionFactory,
TaskCompletionSource`1
retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`
1 re
try)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1
retry)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(
Boolean op
enCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection
, String exceptionCode, String attemptedOperation, Boolean&
closeStoreConnection
OnFailure)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(
Boolean op
enCondition, DbConnection storeConnectionToOpen, DbConnection
originalConnection
, String exceptionCode, String attemptedOperation, Boolean&
closeStoreConnection
OnFailure)
at System.Data.EntityClient.EntityConnection.Open()
at System.Data.Objects.ObjectContext.EnsureConnection()
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.
IEnumerable
>.GetEnumerator()
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.b__3
[TRe
sult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](
IEnum
erable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.
IQueryProvider.E
xecute[S](Expression expression)
at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](
Expressi
on expression)
at System.Linq.Queryable.Any[TSource](IQueryable`1 source, Expression`1
predi
cate)
at StockAnalyze.Analyze.ProcessRawData(String stock, Int32 mv_days, Int3
2 p_days) | H*******g 发帖数: 6997 | |
|