This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
When K2 is configured to use SQL Server alias
and SQL is hosted on a separate machine from the K2 server, the K2 Server service fails to start after upgrade to 5.3
, when K2 Configuration Service is up and running.
When attempting to start the K2 Server service using Services snap-in, you receive a warning message "The K2 Server service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs." as shown on the screenshot below:
When starting K2 Server service in console mode the following error is displayed:
Console output text:
Debug 1013 Creating Instance: SourceCode.CloudLinkService.CloudLinkService Debug 1015 Enrolling Instance : SourceCode.CloudLinkService.CloudLinkService Error 2001 Error Starting Host Server: System.NullReferenceException: Object reference not set to an instance of an object. at SourceCode.CloudLinkService.Badger.BadgerLinkService.Initialize(IServiceMarshalling serviceMarshalling, IServerMarshaling serverMarshalling) at SourceCode.CloudLinkService.CloudLinkService.TryInitialize() at SourceCode.Hosting.Server.Runtime.HostServerEngine.EnrollHostableTypeInstance(IHostableType HostableTypeInstance) at SourceCode.Hosting.Server.Runtime.HostTypeLoader.InitAndEnrollHostableType(String HostedTypeName, String InterfaceName) at SourceCode.Hosting.Server.Runtime.HostTypeLoader.InitAndEnrollHostableTypes(String InterfaceName) at SourceCode.Hosting.Server.Runtime.HostServerEngine.StartHostServer();Error Invoking 'StartHostServer' : SourceCode.HostServerLib : Object reference not set to an instance of an object.
The following error gets logged in the K2 Configuration Service log when attempting to start the K2 Server service:
[Error] An error occurred using the connection to database '"K2"' on server '"%YOUR_SQL_SERVER_ALIAS%"'. System.Data.SqlClient.SqlException (0x80131904): 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)
This is a known issue with K2 5.3. Starting from this version, K2 Server service has a dependency on the K2 Configuration Service
(run in context of K2 Service account). This service is supposed to be running and should be able to connect to the K2 database, otherwise K2 Server service will not be able to start.
Currently the K2 Configuration Service does not support using of SQL alias where you have edited its appsettings.Production.json configuration file and replaced your SQL alias name with the real SQL server name (including instance name and port if necessary).
To resolve this issue you need to perform the following steps:
1. Edit appsettings.Production.json configuration file located in [INSTALL DIR]\SourceCode.Configuration.Api" and replace the SQL alias name with the SQL Server name in the K2ConnectionString as shown below:
2. Restart the K2 Configuration Service
3. Start the K2 Server Service.