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.
After enabling SmOs services endpoints (smoServices enableEndpoints="true") in K2HostServer.exe.config, K2 service fails to start with the following errors:
"Error","General","1","GeneralErrorMessage","SourceCode.Endpoint.Server.EndpointServer.LoadSharedEndpoints","1 Object reference not set to an instance of an object." "Error","System","2001","ServerStartError","SourceCode.Hosting.Server.Runtime.HostServerEngine.StartHostServer","2001 Error Starting Host Server: Object reference not set to an instance of an object."
The error appears after enabling SmOs services endpoints (smoServices enableEndpoints="true") in K2HostServer.exe.config.
Once this setting is enabled, K2 Service fails to start with the errors mentioned above.
When disabling SmOs services endpoints, the service starts without errors.
This could be an issue with an orphaned category. To confirm this, execute the following SQL query against the K2 Database:
SELECT * FROM [Category].[Category] c1
WHERE ParentCategories IS NOT NULL AND NOT EXISTS ( SELECT * FROM [Category].[Category] c2 WHERE c1.ParentCategories.value(N'(/parentcategory/@id)', N'int') = c2.id )
This will search for any categories in the [Category].[Category] table which do not have a parent in the same table (i.e. parent ID refers to non existing record in this table). Normally, such orphan records can just be deleted and most likely this issue is caused by a failed delete operation on a database level.
To resolve this:
- Create a backup of K2 database or the [Category].[Category] table
- Remove the orphaned category
- Enable SmOs services endpoints
- Restart the K2 Service.
Always create a backup of the K2 Database before attempting direct changes on it, even when you're following instructions from documentation or K2 support.