Page 1 of 1

Self Hosted Service Auto Start.  Topic is solved

PostPosted: Fri Jun 23, 2017 7:51 pm
by SBarnes
Hi All,

trying to get the self hosted service to auto start can sometimes not work, even if you set it to delayed.

The error more than likely will be shown by something like this in the event log.

Service cannot be started. System.Data.SqlClient.SqlException (0x80131904): Cannot open database "JiwaDemo7181" requested by the login. The login failed.
Login failed for user 'JiwaLogin'.
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectio...


and is because SQL Server has not finished starting up before the API does.

The following command will fix the problem by creating a dependency on SQL Server for the API service.

Code: Select all
sc config JiwaAPISelfHostedService.exe depend= MSSQLSERVER

Re: Self Hosted Service Auto Start.

PostPosted: Fri Jun 23, 2017 8:20 pm
by Mike.Sheen
Thanks for this information - not sure what we can do about that, as we've seen people already using the REST API with LocalDB - so adding a dependency service might not suit all use cases.

The workaround you've provided will be added to our documentation - thanks again!

Re: Self Hosted Service Auto Start.

PostPosted: Sat Jun 24, 2017 12:31 am
by SBarnes
Hi Mike,

My only other suggestion which would be more of a nicety more than answer would be if the service had the ability to have its own max retries to login and then send an email somehow to let you know it failed which would be good for LocalDB as well I suppose, which could have benefit for use by customers as well??

By the way the same trick should work for the Plugin Scheduler as well.

Re: Self Hosted Service Auto Start.

PostPosted: Wed Jul 05, 2017 2:28 pm
by Mike.Sheen
Thanks - logged as DEV-6059