microsoft / navcontainerhelper

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

Invoke-NavContainerCodeunit fails because of TimeZone ID Error #1660

Closed J-KVS closed 3 years ago

J-KVS commented 3 years ago

Describe the issue If I try to execute a codunit inside the container the following error occures:

The time zone with ID 'Mitteleuropäische Zeit' was not recognized on the server. Update your computer's time zone definitions.

OS: Microsoft Windows 10 Enterprise Version: 10.0.18363 Build 18363 Localization: Germany

Please let me know if you need additional information.

Scripts used to create container and cause the issue

$containerName = 'bcserver'
$password = 'P@ssw0rd'
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credential = New-Object pscredential 'admin', $securePassword
$auth = 'UserPassword'
$licenseFile = ''
$memoryLimit = '8G'
$artifactUrl = Get-BcArtifactUrl -type 'OnPrem' -version '14.6.0.0' -country 'de' -select 'Closest'

New-BcContainer `
    -accept_eula `
    -containerName $containerName `
    -credential $credential `
    -auth $auth `
    -artifactUrl $artifactUrl `
    -licenseFile $licenseFile `
    -isolation 'hyperv' `
    -memoryLimit $memoryLimit `
    -updateHosts `
    -includeCSIDE `
    -doNotExportObjectsToText `

Full output of scripts

BcContainerHelper is version 2.0.2
BcContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - 1909
Docker Client Version is 20.10.0
Docker Server Version is 20.10.0
Removing container bcserver
Removing bcserver from host hosts file
Removing bcserver-* from host hosts file
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Error removing C:\ProgramData\BcContainerHelper\Extensions\bcserver (attempts: 1)
The following files could not be removed:
- C:\ProgramData\BcContainerHelper\Extensions\bcserver\Program Files\140\RoleTailored Client\f
insql.exe
- C:\ProgramData\BcContainerHelper\Extensions\bcserver\Program Files\140\RoleTailored Client\M
icrosoft.Dynamics.Nav.DotNetBridge.dll
- C:\ProgramData\BcContainerHelper\Extensions\bcserver\Program Files\140\RoleTailored Client\M
icrosoft.Dynamics.Nav.Types.dll
- C:\ProgramData\BcContainerHelper\Extensions\bcserver\Program Files\140\RoleTailored Client\n
dbcs.dll
Please close any apps, prompts or files using these files
Retrying in 10 seconds
Fetching all docker images
Using image mcr.microsoft.com/businesscentral:10.0.18363.1256
Creating Container bcserver
Version: 14.6.36463.0-de
Style: onprem
Multitenant: No
Platform: 14.0.36457.0
Generic Tag: 1.0.1.3
Container OS Version: 10.0.18363.1256 (1909)
Host OS Version: 10.0.18363.1256 (1909)
Using hyperv isolation
Using locale de-DE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to en
able)
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- AdditionalSetup.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.18363.1256
46f1550c21dc9fd232c3561f42eac1d6a64150f3b2eaae915bea8258d866ecb6
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/onprem/14.6.36463.0/de
Using installer from C:\Run\130
Copying Platform Artifacts
Copying Application Artifacts
Copying Database
Copy Licensefile
Copying Installers
Copying ConfigurationPackages
Copying TestToolKit
Copying UpgradeToolKit
Copying Extensions
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
Restoring CRONUS Demo Database
Determining Database Collation
Changing Database Server Collation to Latin1_General_100_CI_AS
Restoring CRONUS Demo Database
Installing C:\NAVDVD\Installers\DE\RTC\RoleTailoredClient.Local.De.msi
Skipping C:\NAVDVD\Installers\DE\WebHelp\WebHelp.Local.De.msi
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
Importing CRONUS license file
Generating Symbol Reference
Stopping Business Central Service Tier
Installation took 485 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.0.31 in container hosts file (copy from host hosts fil
e)
Setting gateway.docker.internal to 192.168.0.31 in container hosts file (copy from host hosts 
file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts 
file)
Setting host.containerhelper.internal to 172.21.192.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
WARNING: Container starts with TimeZone = Mitteleuropäische Zeit, which is not recognized in 
the list of TimeZones.
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 9214D619F07473E5855068FDDC141253E3DBD52F
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Creating http download site
Setting SA Password and enabling SA
Creating admin as SQL User and add to sysadmin
Creating SUPER user
Container IP Address: 172.21.195.203
Container Hostname  : bcserver
Container Dns Name  : bcserver
Web Client          : http://bcserver/NAV/
Dev. Server         : http://bcserver
Dev. ServerInstance : NAV
Setting bcserver to 172.21.195.203 in host hosts file

Files:
http://bcserver:8080/ALLanguage.vsix

Container Total Physical Memory is 8.5Gb
Container Free Physical Memory is 6.1Gb

Initialization took 68 seconds
Ready for connections!
Reading CustomSettings.config from bcserver
Creating Desktop Shortcuts for bcserver
Container bcserver successfully created

Use:
Get-BcContainerEventLog -containerName bcserver to retrieve a snapshot of the event log from t
he container
Get-BcContainerDebugInfo -containerName bcserver to get debug information about the container
Enter-BcContainer -containerName bcserver to open a PowerShell prompt inside the container
Remove-BcContainer -containerName bcserver to remove the container again
docker logs bcserver to retrieve information about URL's again
Invoke-NavContainerCodeunit -Codeunitid 80
The time zone with ID 'Mitteleuropäische Zeit' was not recognized on the server. Update your c
omputer's time zone definitions.
at <ScriptBlock>, <No file>: line 25
bei Invoke-ScriptInBcContainer, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2
.0.2\ContainerHandling\Invoke-ScriptInNavContainer.ps1: Zeile 44
bei Invoke-NavContainerCodeunit, C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\
2.0.2\ObjectHandling\Invoke-NavContainerCodeunit.ps1: Zeile 43
bei <ScriptBlock>, <Keine Datei>: Zeile 1
The time zone with ID 'Mitteleuropäische Zeit' was not recognized on the server. Update your 
computer's time zone definitions.
In C:\Program Files\WindowsPowerShell\Modules\BcContainerHelper\2.0.2\ContainerHandling\Invok
e-ScriptInNavContainer.ps1:45 Zeichen:13
+             throw $_.Exception.Message
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The time zone w...ne definitions.:String) [ 
   ], RuntimeException
    + FullyQualifiedErrorId : The time zone with ID 'Mitteleuropäische Zeit' was not recogni 
   zed on the server. Update your computer's time zone definitions.

Screenshots

Additional context

freddydk commented 3 years ago

I think this is because of Hyperv isolation - try to remove that

J-KVS commented 3 years ago

Thank you for the rapid response. Yes, with process isolation I don't have this error. But I get other problems when I choose process isolation. Would it be possible to fix my initial problem with a hyper v isolation?

freddydk commented 3 years ago

It is a docker/Windows version issue, not something I can do anything about, sorry.

J-KVS commented 3 years ago

Ok, in this case we can close this issue and I'll have to open another issue for my problems with process isolation.

IvanArsov commented 2 years ago

Hi @J-KVS , Were you able to solve the problem with the isolation process ? Thanks

J-KVS commented 2 years ago

Hi @IvanArsov,

I switched from working on my local Windows Version to a Windows Server in Azure and had since no problems.

aipungggi commented 6 months ago

Just change the timezone in the container like

$containerName = 'myContainer'
$scriptBlock = {
    Set-TimeZone -Id "Central European Standard Time"
}
Invoke-ScriptInBCContainer -containerName $containerName -scriptblock $scriptBlock