Symptoms
When starting the K2 server as a service it will take a long time and in the end fail to start. When starting the K2 Server in console mode we get the following error:
Error Invoking 'StartHostServer' : SourceCode.HostServerLib: The section is marked as being protected, but it does not have the correct format. It should contain only the child node.
Diagnoses
Initially entries in the Environment.FieldValue table were deleted and a reinstall of K2 was done with this database. This error points to something set wrong in the K2HostServer.exe.config file but after reviewing that file it did not appear anything was set differently from a file on a working machine. Specifically at the node we did not see any connection strings that were off. Most likely doing a reinstall from a K2 Database that did not have entries in the Environment.FieldValue table was the source of the issue. This kind of put everything out of whack.
This same error then appeared on another machine that was separate from the initial one we were troubleshooting. In this scenario the K2 DB needed to be renamed from 'K2_User' to just 'K2'. To go about this process the user went through the Configuration Option in the K2 Blackpearl Setup Manager. Here when he tells the wizard where to find the K2 DB, for database name we put in K2 instead of K2_User. Since the setup manager does not see the 'K2' database already created it runs the scripts to create a K2 database with that name. Now in that SQL instance we have two K2 Databases, one named K2 the other K2_User. This is now where we see the same error detailed above and the Blackpearl server will not start. Most likely this is due to having two K2 Databases present in the same SQL instance.
When we run K2 Setup Manager and select the repair option we the K2 server machine will restart and the repair will not go through.
Resolution
On the first machine we saw this issue on this was solved by reverting the VM back to a previous working state and ensuring that we do not delete the values contained in that Environment.FieldValue table. Now a reinstall should be done successfully. Please note that when we uninstall K2 Blackpearl this does not delete the K2 Database. This must manually be done.
Renming the database is not recommended but if you would like to please, contact k2 support to talk about it.