microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
379 stars 243 forks source link

BC 24.3.21374.22132 Creation with external DB Failed - Service 'Dynamics 365 Business Central Server [BC] (MicrosoftDynamicsNavServer$BC)' cannot be started due to the following error: Cannot start service MicrosoftDynamicsNavServer$BC on computer '.'. #3602

Closed Regatoni closed 1 month ago

Regatoni commented 1 month ago

PLEASE DO NOT INCLUDE ANY PASSWORDS OR TOKENS IN YOUR ISSUE!!!

Describe the issue While trying to Create a Docker Container with BC 24.3.21374.22132 with a DB on another Docker, it failed with the following Error Message:

Service 'Dynamics 365 Business Central Server [BC] (MicrosoftDynamicsNavServer$BC)' cannot be started due to the following error: Cannot start service MicrosoftDynamicsNavServer$BC on computer '.'.

When running the same command but omitting the database parameters, it works

Scripts used to create container and cause the issue

New-BCContainer `
    -accept_eula `
    -accept_outdated `
    -isolation process `
    -artifactUrl "https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/sandbox/24.3.21374.22132/ch" `
    -assignPremiumPlan `
    -containerName SGV-dev-test `
    -auth NAVUserPassword `
    -Credential $BCLogin `
    -alwaysPull `
    -shortcuts DesktopFolder `
    -databaseName SGV-dev-test `
    -databaseCredential $dbLogin `
    -databaseServer DevSQL

Full output of scripts

BcContainerHelper is version 6.0.19
BcContainerHelper is running as administrator
HyperV is Enabled
Host is Microsoft Windows 11 Enterprise - 10.0.22631.3527
UsePsSession is True
UsePwshForBc24 is True
UseWinRmSession is never
UseSslForWinRmSession is True
Docker Client Version is 26.1.1
Docker Server Version is 26.1.1
Removing Session SGV-dev-test
Removing container SGV-dev-test
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\SGV-dev-test
Fetching all docker images
Fetching all docker volumes
Pulling image mcr.microsoft.com/businesscentral:ltsc2022
ltsc2022: Pulling from businesscentral
Digest: sha256:4f18913f58dafe2af1e083627559ed74aabaf919b7b28d10e148cdbaf2ec49c0
Status: Image is up to date for mcr.microsoft.com/businesscentral:ltsc2022
mcr.microsoft.com/businesscentral:ltsc2022
Using image mcr.microsoft.com/businesscentral:ltsc2022
Creating Container SGV-dev-test
Style: sandbox
Multitenant: No
Version: 24.3.21374.22132
Platform: 24.0.22118.0
Generic Tag: 1.0.2.39
Container OS Version: 10.0.20348.2582 (ltsc2022)
Host OS Version: 10.0.22631.3527 (23H2)
Using process isolation
Using locale de-CH
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Files in C:\ProgramData\BcContainerHelper\Extensions\SGV-dev-test\my:
- AdditionalOutput.ps1
- HelperFunctions.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatecontainerhosts.ps1
Creating container SGV-dev-test from image mcr.microsoft.com/businesscentral:ltsc2022
Using Shared Encryption Key file
db7d34f10dc156bcc936683fc2695bd8c38d746fc283756cb58d581d5969e5b5
Waiting for container SGV-dev-test to be ready
Using artifactUrl https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/sandbox/24.3.21374.22132/ch
Using installer from C:\Run\240
Installing Business Central: multitenant=False, installOnly=False, filesOnly=False, includeTestToolkit=False, includeTestLibrariesOnly=False, includeTestFrameworkOnly=False, includePerformanceToolkit=False, appArtifactPath=c:\dl\
sandbox\24.3.21374.22132\ch, platformArtifactPath=c:\dl\sandbox\24.3.21374.22132\platform, databasePath=, licenseFilePath=c:\dl\sandbox\24.3.21374.22132\ch\Cronus.bclicense, rebootContainer=True
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\24.3.21374.22132\platform\ServiceTier\Program Files
c:\dl\sandbox\24.3.21374.22132\platform\ServiceTier\System64Folder
Copying Web Client Files
c:\dl\sandbox\24.3.21374.22132\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\24.3.21374.22132\platform
c:\dl\sandbox\24.3.21374.22132\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\24.3.21374.22132\ch\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\24.3.21374.22132\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\24.3.21374.22132\ch\Extensions
Copying Applications
C:\dl\sandbox\24.3.21374.22132\platform\Applications
Copying Applications.CH
C:\dl\sandbox\24.3.21374.22132\ch\Applications.CH
Copying dependencies
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 8 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.20.192.1 in container hosts file
Starting Container
Hostname is SGV-dev-test
PublicDnsName is SGV-dev-test
Using NavUserPassword Authentication
Import Encryption Key
Stopping local SQL Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 986ADE6C21D28A8DCB479C700A10889DC321215A
DNS identity SGV-dev-test
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Service 'Dynamics 365 Business Central Server [BC] (MicrosoftDynamicsNavServer$BC)' cannot be started due to the following error: Cannot start service MicrosoftDynamicsNavServer$BC on computer '.'.
at <ScriptBlock>, C:\Run\navstart.ps1: line 175
at <ScriptBlock>, C:\Run\start.ps1: line 390
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts-exdbf9fwegejdqak.b02.azurefd.net/sandbox/24.3.21374.22132/ch
Using installer from C:\Run\240
Installing Business Central: multitenant=False, installOnly=False, filesOnly=False, includeTestToolkit=False, includeTestLibrariesOnly=False, includeTestFrameworkOnly=False, includePerformanceToolkit=False, appArtifactPath=c:\dl\
sandbox\24.3.21374.22132\ch, platformArtifactPath=c:\dl\sandbox\24.3.21374.22132\platform, databasePath=, licenseFilePath=c:\dl\sandbox\24.3.21374.22132\ch\Cronus.bclicense, rebootContainer=True
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\24.3.21374.22132\platform\ServiceTier\Program Files
c:\dl\sandbox\24.3.21374.22132\platform\ServiceTier\System64Folder
Copying Web Client Files
c:\dl\sandbox\24.3.21374.22132\platform\WebClient\Microsoft Dynamics NAV
Copying ModernDev Files
c:\dl\sandbox\24.3.21374.22132\platform
c:\dl\sandbox\24.3.21374.22132\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\24.3.21374.22132\ch\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\24.3.21374.22132\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\24.3.21374.22132\ch\Extensions
Copying Applications
C:\dl\sandbox\24.3.21374.22132\platform\Applications
Copying Applications.CH
C:\dl\sandbox\24.3.21374.22132\ch\Applications.CH
Copying dependencies
Importing PowerShell Modules
Skipping restore of Cronus database
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Installation took 8 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.20.192.1 in container hosts file
Starting Container
Hostname is SGV-dev-test
PublicDnsName is SGV-dev-test
Using NavUserPassword Authentication
Import Encryption Key
Stopping local SQL Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 986ADE6C21D28A8DCB479C700A10889DC321215A
DNS identity SGV-dev-test
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Service 'Dynamics 365 Business Central Server [BC] (MicrosoftDynamicsNavServer$BC)' cannot be started due to the following error: Cannot start service MicrosoftDynamicsNavServer$BC on computer '.'.
at <ScriptBlock>, C:\Run\navstart.ps1: line 175
at <ScriptBlock>, C:\Run\start.ps1: line 390
at <ScriptBlock>, <No file>: line 1
New-BCContainer Telemetry Correlation Id: 11964156-1454-4cde-8dd1-da84b7f0261f
Initialization of container SGV-dev-test failed
In C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\6.0.19\ContainerHandling\Wait-NavContainerReady.ps1:42 Zeichen:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...dev-test failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container SGV-dev-test failed
...

Additional context

freddydk commented 1 month ago

What does the event log say? (Get-BcContainerEventLog)

Regatoni commented 1 month ago

Eventlog_Docker_SGV.zip Here is the entire EventLog. The Application Error shows this

Name der fehlerhaften Anwendung: Microsoft.Dynamics.Nav.Server.exe, Version: 24.0.22118.0, Zeitstempel: 0x666b0000
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 10.0.20348.2582, Zeitstempel: 0xf8072450
Ausnahmecode: 0xe0434352
Fehleroffset: 0x000000000003f14c
ID des fehlerhaften Prozesses: 0xb510
Startzeit der fehlerhaften Anwendung: 0x01dadd026649e3ab
Pfad der fehlerhaften Anwendung: C:\Program Files\Microsoft Dynamics NAV\240\Service\Microsoft.Dynamics.Nav.Server.exe
Pfad des fehlerhaften Moduls: C:\Windows\System32\KERNELBASE.dll
Berichtskennung: 8c117e5b-8096-44a0-a9d3-edf4df624547
Vollständiger Name des fehlerhaften Pakets: 
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: 

.NET Runtime:

Die Beschreibung für die Ereignis-ID "1026" aus der Quelle ".NET Runtime" wurde nicht gefunden. Entweder ist die Komponente, die dieses Ereignis auslöst, nicht auf dem lokalen Computer installiert, oder die Installation ist beschädigt. Sie können die Komponente auf dem lokalen Computer installieren oder reparieren.
Falls das Ereignis auf einem anderen Computer aufgetreten ist, mussten die Anzeigeinformationen mit dem Ereignis gespeichert werden.
Die folgenden Informationen wurden mit dem Ereignis gespeichert: 
Application: Microsoft.Dynamics.Nav.Server.exe
CoreCLR Version: 8.0.724.31311
.NET Version: 8.0.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.LoadProperties(Object target, SettingsProvider provider)
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.LoadSettings()
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.LoadAndValidateSettings()
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.CreateInstance(SettingsProvider settingsProvider, ConcurrentDictionary`2 appSpecificSettings)
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.CreateInstance(SettingsProvider settingsProvider, Boolean forceRefresh)
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.CreateInstance(String fileName)
   at Microsoft.Dynamics.Nav.Types.ServerUserSettings.get_Instance()
   at Microsoft.Dynamics.Nav.Types.DiagnosticsExceptionsAllowList.SafeGetAllowedExceptionsForTelemetry()
   at Microsoft.Dynamics.Nav.Types.DiagnosticsExceptionsAllowList.GenerateAllowedExceptionsSet()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.Lazy`1.CreateValue()
   at Microsoft.Dynamics.Nav.Types.DiagnosticsExceptionsAllowList.IsExceptionAllowed(Exception exception)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.ExceptionTelemetryMessages.AppendException(Exception exception, String diagnosticsContext, String callStack, Boolean& shouldEmitTransientTelemetry)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.ComposeExceptionTelemetryMessages(Exception exception, String diagnosticsContext, DiagnosticParameter message, Boolean& shouldEmitTransientTelemetry)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.ComposeAndSendExceptionTraceTag(String tag, Category category, Exception exception, DiagnosticParameter message, Verbosity verbosity, Guid clientSessionId, Guid clientActivityId, String gatewayCorrelationId, String diagnosticsContext, Boolean forceLog, ValueTuple`2[] customDimensions)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.SendExceptionTag(String tag, Category category, Exception exception, Verbosity verbosity, DiagnosticParameter message, String diagnosticsContext, Boolean forceLog, ValueTuple`2[] customDimensions)
   at Microsoft.Dynamics.Nav.WindowsServices.DynamicsNavServer.CurrentDomain_UnhandledException(Object sender, UnhandledExceptionEventArgs e)
Element nicht gefunden

CertificateServicesClient-CertEnroll:

The "Microsoft Passport Key Storage Provider" provider was not loaded because initialization failed.
freddydk commented 1 month ago

Duplicate of #3601