K2 Workspace > Management console's licensing module shows an error indicating it is unable to connect to SQL server

  • 24 February 2022
  • 0 replies
  • 71 views

Userlevel 5
Badge +20
 

K2 Workspace > Management console's licensing module shows an error indicating it is unable to connect to SQL server

kbt162919

PRODUCT
K2 blackpearl 4.7
BASED ON
K2 blackpearl 4.7
TAGS
K2 Workspace
Management Console
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.
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Issue

When accessing the licensing module in the legacy K2 Workspace's Management Console, the following error is shown:
 

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)
 

Image

Symptoms

  • All other modules in the Management console are working properly.
  • If you happen to attempt to apply a Cumulative Update or FixPack, the update will fail, and you will see the following error in the InstallerTrace logs:
     
    Error from controlutil output: RegisterControlTypes Failed: Object reference not set to an instance of an object.

     
  • In your HostServer logs, you will also see a similar error:
     
    "Error","System","2025","InternalMarshalError","SourceCode.Hosting.Server.Runtime.HostServerBroker.InternalMarshal","2025 Error Marshalling SourceCode.Hosting.Servers.LicenseManagement.GetUserObjectCountForLicenses, 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) 
    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, SqlAuthenticationProviderManager sqlAuthProviderManager) 
    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, 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.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) 
    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) 
    at System.Data.SqlClient.SqlConnection.Open() 
    at SourceCode.Data.ReliableDbConnection.b__42_1() at SourceCode.Data.Logging.IDataLoggingProviderExtensions.<>c__DisplayClass0_0.b__0() 
    at SourceCode.Data.Logging.IDataLoggingProviderExtensions.ExecuteAction[TResult](IDataLoggingProvider provider, RetryPolicy retryPolicy, Func`1 func) 
    at SourceCode.Data.Logging.IDataLoggingProviderExtensions.<>c__DisplayClass0_0.b__0() at SourceCode.Data.Logging.IDataLoggingProviderExtensions.ExecuteAction[TResult](IDataLoggingProvider provider, RetryPolicy retryPolicy, Func`1 func) 
    at SourceCode.Data.ReliableDbConnection.Open() at SourceCode.Data.TransactionalTransactionFrame.OnNotifyConnection(ReliableDbConnection connection) 
    at SourceCode.Data.TransactionFrame.NotifyConnection(ReliableDbConnection connection) at SourceCode.Data.Dac.CreateConnection(String connectionString) 
    at SourceCode.Data.TransactionalTransactionFrame.OnGetConnection(String connectionString) at SourceCode.Data.TransactionFrame.GetConnection(String connectionString) 
    at SourceCode.Data.Dac.GetConnection() at SourceCode.Data.Dac.ExecuteReader(CommandBehavior commandBehavior, CommandType commandType, String commandText, IEnumerable`1 parameters) 
    at SourceCode.Forms.Runtime.Store.<>c__DisplayClass89_0`1.b__0(IReliableDbTransaction transaction) at SourceCode.Data.Dac.ExecuteInTransaction(AmbientTransactionOption option, Action`1 unitOfWork) 
    at SourceCode.Forms.Runtime.Store.ExecuteReader[T](Dac dac, String storedProcedureName, Object[] parameters, Func`2 unitOfWork) at SourceCode.Forms.Runtime.Store.GetUserObjectCount() 
    at SourceCode.Forms.Runtime.ManagementServer.GetUserObjectCount() at SourceCode.Hosting.Servers.LicenseManagement.GetUserObjectCountForLicenses() InnerException: 
      The system cannot find the file specified

Troubleshooting Steps

To resolve this, first, try to decrypt the connection strings in SourceCode.Forms.Runtime.config:
 

  1. On your K2 blackpearl server, please go to [Program Files]K2 blackpearlHost ServerBin, copy SourceCode.Forms.Runtime.config.
  2. Go to C: (or whichever drive you want), create a temporary folder, and name it K2ConfigForms.
  3. Copy the SourceCode.Forms.Runtime.config to the K2ConfigForms folder you created.
  4. Rename the SourceCode.Forms.Runtime.config in K2ConfigForms to web.config.
  5. Open command prompt with admin privileges, and run the following:
     
    cd C:WindowsMicrosoft.NETFramework64v4.0.30319
  6. Then run the following (replace C: with the driver where you create K2ConfigForms):
     
    aspnet_regiis.exe -pdf "connectionStrings" "C:K2ConfigForms"

If no errors are shown during the decryption process, open web.config in the K2ConfigForms folder, and inspect the connection strings. Make sure the following line is correctly referencing the SQL server that your K2 database resides in:
 

<add name="Forms.Data.ConnectionString" connectionString="Data Source=[Your SQL Server];Initial Catalog=[your K2 database];integrated security=sspi;Pooling=True" />

If the connection string is pointing to the wrong SQL server or K2 database:
 

  1. Create a backup of your existing SourceCode.Forms.Runtime.config.
  2. Update web.config in K2FormsConfig with the correct connection string.
  3. Rename web.config in K2FormsConfig to SourceCode.Forms.Runtime.config.
  4. Replace your existing SourceCode.Forms.Runtime.config with the newly updated one.
  5. Restart your K2 blackpearl service.

If you are unable to decrypt the config file, then the encrypted connection strings are most likely corrupted. In that case, you will need to manually repair the config file.
 

  1. Create a backup of your existing SourceCode.Forms.Runtime.config
  2. Edit SourceCode.Forms.Runtime.config, and remove the following section:
     
    <connectionStrings configProtectionProvider="K2ConfigurationKey">
      ...
    </connectionStrings>

     
  3. Then above </configuration>, add the following section, and replace the value accordingly:
     
    <connectionStrings>
       <add name="Forms.Data.ConnectionString" connectionString="Data Source=[Your SQL Server];Initial Catalog=[your K2 database];integrated security=sspi;Pooling=True" />
    </connectionStrings>

     
  4. Restart your K2 blackpearl service.

0 replies

Be the first to reply!

Reply