Navcontainerhelper: new-navcontainer /bc-container - Restarting Service Tier failes - (own Database)

Created on 31 Mar 2020  路  8Comments  路  Source: microsoft/navcontainerhelper

we use a script to run our local docker container with databases hosted on our server (reachable via wan).
till today, we managed to get the containers up and running (ok with some days of ....you know what(!) )
today the new-navcontainer / or new-bccontainer fails.

here is the part of the script we r using (restarting service tier takes about 15mins till failure):

        New-BCContainer -accept_eula `
                        -accept_outdated `
                        -containerName $containerName `
                        -Auth NavUserPassword `
                        -imageName $imageName `
                        -Credential $navCred `
                        -isolation hyperv `
                        -databaseServer $databaseServer `
                        -databaseInstance $databaseInstance `
                        -databaseName $databaseName `
                        -databaseCredential $databaseCredential `
                        -enableSymbolLoading `
                        -doNotExportObjectsToText `
                        -includeCSIDE `
                        -updateHosts `
                        -memoryLimit $memoryLimit `
                        -useBestContainerOS

hint: i added -isolation to check if it will help, but same result like with processIsolation
hint2: we tried to omit also "-useBestContainerOS"
hint3: tried with new-navcontainer instead of new-bccontainer
hint4: database is a bc14 rtm db --> tried some others (and sure other cumulative updates)

in de Logs of the container, when it is trying to restart the nst, i think see that it is trying to connect with the standard cronus db on the sqlexpress of the container - maybe with my credentials, which will surely not be correct

PS C:\Users\StephanWeikelt\Documents\DevOps\Scripte> New-BCContainer -accept_eula `
                        -accept_outdated `
                        -containerName $containerName `
                        -Auth NavUserPassword `
                        -imageName $imageName `
                        -Credential $navCred `
                        -isolation hyperv `
                        -databaseServer $databaseServer `
                        -databaseInstance $databaseInstance `
                        -databaseName $databaseName `
                        -databaseCredential $databaseCredential `
                        -enableSymbolLoading `
                        -doNotExportObjectsToText `
                        -includeCSIDE `
                        -updateHosts `
                        -memoryLimit $memoryLimit `
                        -useBestContainerOS
NavContainerHelper is version 0.6.5.2
NavContainerHelper is running as administrator
Host is Microsoft  - 1909
Docker Client Version is 19.03.8
Docker Server Version is 19.03.8
Using image mcr.microsoft.com/businesscentral/onprem:1904-rtm-de-ltsc2019
Removing notWorkingContainer from host hosts file
Removing C:\ProgramData\NavContainerHelper\Extensions\notWorkingContainer
Creating Container notWorkingContainer
Version: 14.0.29537.0-de
Style: onprem
Platform: 14.0.29530.0
Generic Tag: 0.0.9.5
Container OS Version: 10.0.17763.437 (ltsc2019)
Host OS Version: 10.0.18363.720 (1909)
A better Generic Container OS exists for your host (mcr.microsoft.com/dynamicsnav:10.0.183
Using generic image mcr.microsoft.com/dynamicsnav:10.0.18363.720-generic
Patching navinstall.ps1 for 13.x and 14.x (issue #907)
Generic Container OS Version: 10.0.18363.720 (1909)
Generic Tag of better generic: 0.0.9.99
Using locale de-DE
Using hyperv isolation
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog t
Downloading C:\ProgramData\NavContainerHelper\Extensions\notWorkingContainer\my\navinstall.ps1
Files in C:\ProgramData\NavContainerHelper\Extensions\notWorkingContainer\my:
- AdditionalOutput.ps1
- AdditionalSetup.ps1
- MainLoop.ps1
- navinstall.ps1
- SetupVariables.ps1
- SetupWebClient.ps1
- updatehosts.ps1
Creating container notWorkingContainer from image mcr.microsoft.com/dynamicsnav:10.0.18363.720-generic
d12953254e69cd3e46be7fb98f124de8fd424fc6734139126b87922b7c890392
Waiting for container notWorkingContainer to be ready
Installing Business Central
Installing Url Rewrite
Installing OpenXML
Installing DotNetCore
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
Copying Web Client Files
Copying Windows Client Files
Copying PowerShell Scripts
Copying ConfigurationPackages
Copying Test Assemblies
Copying TestToolKit
Copying UpgradeToolKit
Copying Extensions
Copying ClientUserSettings
Copying ReportBuilder
Changing Database Server Collation to Latin1_General_100_CI_AS
SQL Server 2017 transmits information about your installation experience, as well as otherearn more about SQL Server 2017 data processing and privacy controls, please see the Priva
Copying 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'
Starting Business Central Service Tier
Installation took 113 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.41.152 in container hosts file (copy from host hos
Setting gateway.docker.internal to 192.168.41.152 in container hosts file (copy from host 
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host ho
Setting host.containerhelper.internal to 172.21.0.1 in container hosts file
Starting Container
Hostname is notWorkingContainer
PublicDnsName is notWorkingContainer
WARNING: Container starts with TimeZone = Mitteleurop盲ische Zeit, which is not recognized 
Using NavUserPassword Authentication
Import Encryption Key
Stopping local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to
stop...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to
stop...
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 80B182F6353DEB5BE5741FD76DB6BC83D540FDB7
Modifying Service Tier Config File with Instance Specific Settings
Restarting Service TierError
Installing Business Central
Installing Url Rewrite
Installing OpenXML
Installing DotNetCore
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
Copying Web Client Files
Copying Windows Client Files
Copying PowerShell Scripts
Copying ConfigurationPackages
Copying Test Assemblies
Copying TestToolKit
Copying UpgradeToolKit
Copying Extensions
Copying ClientUserSettings
Copying ReportBuilder
Changing Database Server Collation to Latin1_General_100_CI_AS
SQL Server 2017 transmits information about your installation experience, as well as otherearn more about SQL Server 2017 data processing and privacy controls, please see the Priva
Copying 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'
Starting Business Central Service Tier
Installation took 113 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.41.152 in container hosts file (copy from host hos
Setting gateway.docker.internal to 192.168.41.152 in container hosts file (copy from host 
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host ho
Setting host.containerhelper.internal to 172.21.0.1 in container hosts file
Starting Container
Hostname is notWorkingContainer
PublicDnsName is notWorkingContainer
WARNING: Container starts with TimeZone = Mitteleurop盲ische Zeit, which is not recognized 
tance Specific Settings
Restarting Service Tier
Initialization of container notWorkingContainer failed
In C:\Program Files\WindowsPowerShell\Modules\navcontainerhelper\0.6.5.2\ContainerHandling\Wait-NavContainerReady.ps1:44 Zeichen:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization of container notWorkingContainer failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container notWorkingContainer failed
bug Fix Ready Ships in a future version

All 8 comments

Update:
NavContainerHelper is version 0.6.5.3

we got still the same problem.
tried to connect to my local sql server and use a db inside of it - not working
hangs @ Restarting NST

Self Signed Certificate Thumbprint CDC9C0A065027DF77444E342711FE6A310AD20DE
Modifying Service Tier Config File with Instance Specific Settings
Restarting Service Tier

are we the only ones who use "external" sql-dbs in docker - with bc and nav? all of my collegues have the same issue - maybe my script is not working correctly, but how can it be determinated?
all of our former containers - created with exactly the same script - are working, but we won't get new ones up and running :'(

Sorry for the delay.
Could you try to use Get-NavContainerEventLog on your failed container and see what the eventlog says is wrong?

yeah for sure - i don't know why it is using "LOCALHOST\SQLEXPRESS"

...
Starting Container
Hostname is freddy
PublicDnsName is freddy
Using NavUserPassword Authentication
Import Encryption Key
Stopping local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to
stop...
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 9DA6B0C30509DEE3AFC5678D144559E8170D74F0
Modifying Service Tier Config File with Instance Specific Settings
**Restarting Service Tier**
---->>> here it  hangs

1.)

Server instance: NAV
Tenant ID: nav-systemapplication
Session type: Background
Session ID: 2
User: 
Type: System.Data.SqlClient.SqlException
ClientConnectionId: 46a30bc3-dc8c-449f-97ff-4472c24fcb0a
Class: 20
LineNumber: 0
Number: -1
Server: LOCALHOST\SQLEXPRESS
State: 0
Source: .Net SqlClient Data Provider
ErrorCode: -2146232060
Message: A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
StackTrace:
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
     at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
     at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
     at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
     at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
     at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
     at System.Data.SqlClient.SqlInternalTransaction.Commit()
     at System.Data.SqlClient.SqlTransaction.Commit()
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()
HResult: -2146232060
StackTrace:
     at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
     at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
     at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
     at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
     at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
     at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
     at System.Data.SqlClient.SqlInternalTransaction.Commit()
     at System.Data.SqlClient.SqlTransaction.Commit()
     at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()

2.)

Server instance: NAV
Category: Sql
ClientSessionId: 00000000-0000-0000-0000-000000000000
ClientActivityId: 209b55ce-47f0-4bb9-baeb-3e567c0ddf4e
ServerSessionUniqueId: 9fdc2448-83ce-416b-a727-bce8e98394d4
ServerActivityId: f4ea44a2-757e-4e3b-a517-5600b5eb4d23
EventTime: 04/08/2020 09:32:50
Message (SqlException): RootException: SqlException
A transport-level error has occurred when sending the request to the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
ExceptionStackTrace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
   at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
   at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
   at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalTransaction.Commit()
   at System.Data.SqlClient.SqlTransaction.Commit()
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()
CallerStackTrace:
   at Microsoft.Dynamics.Nav.Runtime.LogWriterHelper.LogExceptionEventWithTelemetry(String tag, Category category, Exception exception, Verbosity verbosity, EventLogEntryType eventLogEntryType)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.CloseDeadConnection(DbException exception, Boolean logException)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.HandleDeadConnection(SqlExceptionAdapter exceptionAdapter, Exception lastException)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.MapException(SqlExceptionAdapter exceptionAdapter, String commandText, Boolean isRollbackAction, Nullable`1 timeout)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()
   at Microsoft.Dynamics.Nav.Types.NavThread.<>c__DisplayClass30_0.<RunExternalAction>b__0()
   at Microsoft.Dynamics.Nav.Types.NavThread.RunExternalAction[T](Func`1 action)
   at Microsoft.Dynamics.Nav.Types.NavThread.RunExternalAction(Action action)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass123_0.<ExecuteActionWithTrace>b__0(Stopwatch watch)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.<>c__DisplayClass93_0.<SendTraceTagOnThreshold>b__0(Stopwatch watch)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.SendTraceTagOnThreshold[T](String tag, Category category, Verbosity verbosity, Int32 threshold, Func`2 action, PrivacyClassification classification, Func`1 includedMessage, String message, Func`1 parameters)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.SendTraceTagOnThreshold(String tag, Category category, Verbosity verbosity, Int32 threshold, Action`1 action, PrivacyClassification classification, Func`1 includedMessage, String message, Func`1 parameters)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteActionWithTrace(EventTask task, String tenantId, Int32 sessionId, String userName, Action action, String commandText, Boolean isAdoCommand)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.EndTransaction(NavSqlEndTransactionType endType)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnectionScope.OnDisposing()
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnectionScope.Dispose(Boolean disposing)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.InnerDispose()
   at Microsoft.Dynamics.Nav.Runtime.NavSession.<DisposeAsync>d__132.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.DisposeAsync(ShutdownScope shutdownScope, Boolean notifyClient, Boolean abortChannel, Boolean alwaysAsync, Boolean externalStopRequest)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.Dispose(Boolean disposing)
   at Microsoft.Dynamics.Nav.Runtime.NavTenant.Microsoft.Dynamics.Nav.Runtime.ITenantSessionHandler.RunTenantActionInSystemSession(Action`2 action, Boolean throwExceptions, Boolean useCurrentCulture, Boolean allowAppsDisabledMode, LanguageSetting language)
   at Microsoft.Dynamics.Nav.Runtime.AssemblyGetter.CompileBusinessApplicationEvents()
   at Microsoft.Dynamics.Nav.Runtime.NCLCodeLoader.CompileBusinessEventAssemblies()
   at Microsoft.Dynamics.Nav.Runtime.NavEnvironment.OnApplicationMounted()
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.AddSystemTenant(String appDatabaseServerName, String appDatabaseName, String appDatabaseUserName, ProtectedDatabasePassword appDatabasePassword, Boolean verifyConnection, String newEncryptionKey, IDatabasePasswordPublicEncryptionKeyStorage keyStorage, Boolean allowOverwritePublicKey, Boolean verifyServerInstanceKey)
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.AddSingleLegacyTenant(String databaseServerName, String databaseName, String databaseUserName, ProtectedDatabasePassword databasePassword, EncryptionProvider encryptionProvider, AzureKeyVaultSettings azureKeyVaultSettings)
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.ConfigureTenants(ServerUserSettings settings, String encryptionKey)
   at Microsoft.Dynamics.Nav.Runtime.NavTaskFactory.<>c__DisplayClass11_0.<StartNewTask>b__0()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)


ProcessId: 28340
Tag: 000018O
ThreadId: 12
CounterInformation: 

3.)

Server instance: NAV
Category: Sql
ClientSessionId: 00000000-0000-0000-0000-000000000000
ClientActivityId: 209b55ce-47f0-4bb9-baeb-3e567c0ddf4e
ServerSessionUniqueId: 9fdc2448-83ce-416b-a727-bce8e98394d4
ServerActivityId: f4ea44a2-757e-4e3b-a517-5600b5eb4d23
EventTime: 04/08/2020 09:32:50
Message (SqlException): This message had personal data removed. The original may still be in transient telemetry. Find it using the transientTelemetryId.
RootException: SqlException
ExceptionStackTrace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle handle, SNIPacket packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
   at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
   at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
   at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalTransaction.Commit()
   at System.Data.SqlClient.SqlTransaction.Commit()
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()
CallerStackTrace:
   at Microsoft.Dynamics.Nav.Runtime.LogWriterHelper.LogExceptionEventWithTelemetry(String tag, Category category, Exception exception, Verbosity verbosity, EventLogEntryType eventLogEntryType)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.CloseDeadConnection(DbException exception, Boolean logException)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.HandleDeadConnection(SqlExceptionAdapter exceptionAdapter, Exception lastException)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.MapException(SqlExceptionAdapter exceptionAdapter, String commandText, Boolean isRollbackAction, Nullable`1 timeout)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass120_0.<ExecuteAction>b__0()
   at Microsoft.Dynamics.Nav.Types.NavThread.<>c__DisplayClass30_0.<RunExternalAction>b__0()
   at Microsoft.Dynamics.Nav.Types.NavThread.RunExternalAction[T](Func`1 action)
   at Microsoft.Dynamics.Nav.Types.NavThread.RunExternalAction(Action action)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.<>c__DisplayClass123_0.<ExecuteActionWithTrace>b__0(Stopwatch watch)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.<>c__DisplayClass93_0.<SendTraceTagOnThreshold>b__0(Stopwatch watch)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.SendTraceTagOnThreshold[T](String tag, Category category, Verbosity verbosity, Int32 threshold, Func`2 action, PrivacyClassification classification, Func`1 includedMessage, String message, Func`1 parameters)
   at Microsoft.Dynamics.Nav.Diagnostic.NavDiagnostics.SendTraceTagOnThreshold(String tag, Category category, Verbosity verbosity, Int32 threshold, Action`1 action, PrivacyClassification classification, Func`1 includedMessage, String message, Func`1 parameters)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.ExecuteActionWithTrace(EventTask task, String tenantId, Int32 sessionId, String userName, Action action, String commandText, Boolean isAdoCommand)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnection.EndTransaction(NavSqlEndTransactionType endType)
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnectionScope.OnDisposing()
   at Microsoft.Dynamics.Nav.Runtime.NavSqlConnectionScope.Dispose(Boolean disposing)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.InnerDispose()
   at Microsoft.Dynamics.Nav.Runtime.NavSession.<DisposeAsync>d__132.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.DisposeAsync(ShutdownScope shutdownScope, Boolean notifyClient, Boolean abortChannel, Boolean alwaysAsync, Boolean externalStopRequest)
   at Microsoft.Dynamics.Nav.Runtime.NavSession.Dispose(Boolean disposing)
   at Microsoft.Dynamics.Nav.Runtime.NavTenant.Microsoft.Dynamics.Nav.Runtime.ITenantSessionHandler.RunTenantActionInSystemSession(Action`2 action, Boolean throwExceptions, Boolean useCurrentCulture, Boolean allowAppsDisabledMode, LanguageSetting language)
   at Microsoft.Dynamics.Nav.Runtime.AssemblyGetter.CompileBusinessApplicationEvents()
   at Microsoft.Dynamics.Nav.Runtime.NCLCodeLoader.CompileBusinessEventAssemblies()
   at Microsoft.Dynamics.Nav.Runtime.NavEnvironment.OnApplicationMounted()
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.AddSystemTenant(String appDatabaseServerName, String appDatabaseName, String appDatabaseUserName, ProtectedDatabasePassword appDatabasePassword, Boolean verifyConnection, String newEncryptionKey, IDatabasePasswordPublicEncryptionKeyStorage keyStorage, Boolean allowOverwritePublicKey, Boolean verifyServerInstanceKey)
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.AddSingleLegacyTenant(String databaseServerName, String databaseName, String databaseUserName, ProtectedDatabasePassword databasePassword, EncryptionProvider encryptionProvider, AzureKeyVaultSettings azureKeyVaultSettings)
   at Microsoft.Dynamics.Nav.Runtime.NavTenantCollection.ConfigureTenants(ServerUserSettings settings, String encryptionKey)
   at Microsoft.Dynamics.Nav.Runtime.NavTaskFactory.<>c__DisplayClass11_0.<StartNewTask>b__0()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart(Object obj)


ProcessId: 28340
Tag: 000018O
ThreadId: 12
CounterInformation: 

4.)

Server instance: NAV
Category: Sql
ClientSessionId: 00000000-0000-0000-0000-000000000000
ClientActivityId: 209b55ce-47f0-4bb9-baeb-3e567c0ddf4e
ServerSessionUniqueId: 9fdc2448-83ce-416b-a727-bce8e98394d4
ServerActivityId: f4ea44a2-757e-4e3b-a517-5600b5eb4d23
EventTime: 04/08/2020 09:32:50
Message Tenant ID: nav-systemapplication
Session type: Background
Session ID: 2
The connection to SQL server was lost
Database server: LOCALHOST\SQLEXPRESS
Database name: CRONUS.
ProcessId: 28340
Tag: 00001NL
ThreadId: 12
CounterInformation: 

The problem here is that when using -useBestContainerOS, it will re-platform the container. When doing that it performs an install of Business Central on the fly (in the new container) and it leaves the service tier running (using SQL Express which always gets used during install - could be optimized in this case).
Then it stops the local SQL Server, configures the container and normally it would start the Service Tier - but since that is already running - it tries to restart it - which fails because the local SQL Server isn't running.
I will fix this in the ContainerHelper for old images and in the next the generic image.
In the meantime, you can add this parameter to your new-navcontainer:

-myscripts @( @{ "navinstall.ps1" = '. "c:\run\navinstall.ps1"; Stop-Service -Name $NavServiceName -WarningAction Ignore' } )

Which will stop the service tier after installation - and now it will not restart, but start the service tier after configuration.

hmmm
"hint2: we tried to omit also "-useBestContainerOS""
--> didn't work

BUT(!) with your additional parameter, it runs like a charm!
thnks for rescue me again ;)
<3

Note that with the next containerhelper, that parameter will automatically be applied if the generic image doesn't contain the fix. You might need to remove your parameter when that happens.

Note that with the next containerhelper, that parameter will automatically be applied if the generic image doesn't contain the fix. You might need to remove your parameter when that happens.

jep - my collegues have to use the param by themself because i'll not update my script.
so thnank you very much again!

Was this page helpful?
0 / 5 - 0 ratings