Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnetcore : Cannot access Kerberos ticket. Ensure Kerberos has been initialized with 'kinit'

I trying to run and aspnet core app, on ubuntu, using vscode. when a run the app, it give me this error:

  System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean buffer)
   at Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
   at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable`1 valueBuffers, Boolean throwOnNullResult)
   at lambda_method(Closure , QueryContext )
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_0`1.<CompileQueryCore>b__0(QueryContext qc)
ClientConnectionId:d48c3450-07f9-4cac-bc5f-97e7f7efa54a

But I not using Integrated authentication, my connection string look like this: "DefaultConnection": "Data Source=localhost;Initial Catalog=School360Db;User Id=[user];Password=[password];Trusted_Connection=True;MultipleActiveResultSets=true"

I test this on windows and it work!.

Any idea?

like image 374
jcmordan Avatar asked Oct 20 '17 23:10

jcmordan


2 Answers

as stated by @jcmordan in the comments - set Trusted_Connection=False.

like image 154
christopher_h Avatar answered Sep 24 '22 01:09

christopher_h


I had a similar problem.

I am using linux OS and Rider IDE,

I solved it by changing my connection string in appsettings.json:

"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=ExampleDB;User=SA;Password=mypassword;ConnectRetryCount=0;MultipleActiveResultSets=true"

}

Try this format.

like image 36
Bukunmi Avatar answered Sep 24 '22 01:09

Bukunmi