PowerShell Universal 3.2.0 can't start service

Product: PowerShell Universal
Version: 3.2.0

Hi,
I downloaded MSI version 3.2.0 and ran on a stand-alone Windows Server 2016.
It installed successfully but when the service can’t start with error
“The PowerShell Universal service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.”

Windows Administrative Event 1026 .NET Runtime with the below info.
I have tried uninstall then reinstall but got the same result.
Any suggestion is greatly appreciated.

Cheers,
Hoang

Application: Universal.Server.exe
CoreCLR Version: 6.0.722.32202
.NET Version: 6.0.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
at Microsoft.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue)
at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary2 parsetable, String connectionString, Boolean buildChain, Dictionary2 synonyms, Boolean firstKey)
at Microsoft.Data.Common.DbConnectionOptions…ctor(String connectionString, Dictionary2 synonyms) at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.<>c__DisplayClass18_0.<Exists>b__0(DateTime giveUp) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_02.b__0(DbContext c, TState s)
at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.<>c__DisplayClass31_02.<Execute>b__0(DbContext context, TState state) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.ExecuteImplementation[TState,TResult](Func3 operation, Func3 verifySucceeded, TState state) at Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded) at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func2 operation, Func2 verifySucceeded) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists(Boolean retryOnNotExists) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerDatabaseCreator.Exists() at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists() at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration) at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade) at PowerShellUniversal.SQL.DatabaseFeature.InitializeDatabase(IConfiguration configuration) in C:\actions-runner\_work\universal\universal\src\PowerShellUniversal.SQL\Plugin.cs:line 53 at Universal.Server.Services.PluginService..ctor(IConfiguration configuration) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\PluginService.cs:line 73 at Universal.Server.Startup.ConfigureServices(IServiceCollection services) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Startup.cs:line 63 at System.RuntimeMethodHandle.InvokeMethod(Object target, Span1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.g__Startup|0(IServiceCollection serviceCollection)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.b__0(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass13_0.b__0(HostBuilderContext context, IServiceCollection services)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Universal.Server.Program.<>c__DisplayClass3_0.b__0(Options o) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 71
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
at Universal.Server.Program.Main(String args) in C:\actions-runner_work\universal\universal\src\Universal.Server\Program.cs:line 53

could this be relevant by any chance?
MSI Upgrade to 3.2.0 Issues - Failed - PowerShell Universal - Ironman Software Forums

Hi PorreKaj,
Thanks for your reply. It’s not the same.
Mine is the first time installation.
It seems the exception related to SQL connection.
The server has MS SQL Express 2019 running but the installation doesn’t have steps to configure.
C:\ProgramData\PowershelUniversal\appsettings.json has the below content
{
“Kestrel”: {
“Endpoints”: {
“HTTP”: {
“Url”: “http://*:5000”
}
}
},
“Plugins”: [
“SQL”
],
“Data”: {
“RepositoryPath”: “%ProgramData%\UniversalAutomation\Repository”,
“ConnectionString”: “%ProgramData%\UniversalAutomation\database.db”
}
}

However I don’t see folder UniversalAutomation at all.

Hope it sheds more light.
Cheers,
Hoang

1 Like

The Connection string isn’t valid for connecting to an SQL Server.

Likely you’ll need something similar to:

Data Source=localhost\sqlexpress;Initial Catalog=<DatabaseName>;Integrated Security=True;Trusted Connection=True

Replace with the name of the database you created, also it all of it depends on your specific environment of course.

Thanks tholabrk,
Where do I find the connection string?
Do I need to to create UniversalAutomation with file database.db?
Can I have a sample databse.db file?

database.db is the LiteDB database, the connection string in your appsettings.json file is for connecting to the LiteDB database, you need to replace the connection string for one connecting to a SQL server like the example I gave you.

As tholabrk mentioned, you will need to modify your appsettings.json located in %ProgramData%\PowerShellUniversal

You may also have to append ;TrustServerCertificate=True; onto your connection string, in my scenario, I did.

Hi all,
Thank you all for your advice.
I re-installed using zip file and had no problem.
I found that the zip package using LiteDB by default.
I don’t link to DB yet so it’s enough for now. I’ll change the connection to SQL later.

Cheers,
Hoang