microsoft / nav-docker

Official Microsoft repository for Dynamics NAV in Docker resources. It has not been decided yet, to which extend Microsoft will ship Docker images with NAV, so everything in this repo is work in progress and might be subject to deletion.
MIT License
179 stars 92 forks source link

Container creation fails with "the license file is corrupt" #477

Closed svengrav closed 4 years ago

svengrav commented 4 years ago

Good morning, since friday i have problems to create new containers. The container creation fails with the message "License" is corrupt.

The license can be imported without problems in installations without a docker container.

I have tested the following scenarios:

Each attempt resulted in the same message:

The license file is corrupt. Error Code: -200. at , C:\Run\SetupLicense.ps1: line 29 at , C:\Run\navstart.ps1: line 161 at , C:\Run\start.ps1: line 223 at , : line 1

The generic image is: mcr.microsoft.com/dynamicsnav:10.0.17134.1130-generic

The head of the license: Produkt Linie : Microsoft Dynamics 365 Business Central on premises Produkt-Edition : Unspecified Produkt-Version : 16 Land : Germany Sprache : German Erstellungsdatum : 15.07.2020 05:26:26 (-07:00) Abl.Dtm. : 13.10.2020 Konfiguration : BC - Entwicklerlizenz V 16

I would appreciate help 👍

Full Log:

ContainsPersonalOrRestrictedInformation: True                             
                                                                     DiagnosticsSuppress: False                                                
                                                                     DiagnosticsMessage: Message not shown because the                         
                                                                     NavBaseException(string, Exception, bool) constructor was used.           
                                                                     MessageWithoutPrivateInformation: Message not shown because the           
                                                                     NavBaseException(string, Exception, bool) constructor was used.           
                                                                     SuppressExceptionCreatedEvent: False                                      
                                                                     FatalityScope: None                                                       
                                                                     ErrorLevel: Error                                                         
                                                                     Message: The license file is corrupt. Error Code: -200.                   
                                                                     StackTrace:                                                               
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.DoOpenA
                                                                     dminConnection(IAdminService adminService)                                
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.Establi
                                                                     shAdminConnection()                                                       
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.Interna
                                                                     lValidate()                                                               
                                                                          at Microsoft.Dynamics.Nav.Management.NavCommand.ProcessRecord()      
                                                                     Source: Microsoft.Dynamics.Nav.Management                                 
                                                                     HResult: -2146233088                                                      
                                                                     StackTrace:                                                               
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.DoOpenA
                                                                     dminConnection(IAdminService adminService)                                
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.Establi
                                                                     shAdminConnection()                                                       
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.Interna
                                                                     lValidate()                                                               
                                                                          at Microsoft.Dynamics.Nav.Management.NavCommand.ProcessRecord()      
                                                                     ----------------------------------                                        
                                                                     Type: System.ServiceModel.FaultException`1[[Microsoft.Dynamics.Nav.Types.S
                                                                     erverFault, Microsoft.Dynamics.Nav.Types, Version=16.0.0.0,               
                                                                     Culture=neutral, PublicKeyToken=31bf3856ad364e35]]                        
                                                                     Action: http://www.microsoft.com/Dynamics/NAV/51/ServerFault              
                                                                     Message: The license file is corrupt. Error Code: -200.                   
                                                                     StackTrace:                                                               

                                                                       Server stack trace:                                                     
                                                                          at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOpera
                                                                     tionRuntime operation, ProxyRpc& rpc)                                     
                                                                          at System.ServiceModel.Channels.ServiceChannel.Call(String action,   
                                                                     Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]   
                                                                     outs, TimeSpan timeout)                                                   
                                                                          at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMe
                                                                     thodCallMessage methodCall, ProxyOperationRuntime operation)              
                                                                          at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage  
                                                                     message)                                                                  

                                                                       Exception rethrown at [0]:                                              
                                                                          at                                                                   
                                                                     System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage    
                                                                     reqMsg, IMessage retMsg)                                                  
                                                                          at                                                                   
                                                                     System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&      
                                                                     msgData, Int32 type)                                                      
                                                                          at Microsoft.Dynamics.Nav.Types.IAdminService.OpenAdminConnection(Con
                                                                     nectionRequest connectionRequest)                                         
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.DoOpenA
                                                                     dminConnection(IAdminService adminService)                                
                                                                     Source: mscorlib                                                          
                                                                     HResult: -2146233087                                                      
                                                                     StackTrace:                                                               

                                                                       Server stack trace:                                                     
                                                                          at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOpera
                                                                     tionRuntime operation, ProxyRpc& rpc)                                     
                                                                          at System.ServiceModel.Channels.ServiceChannel.Call(String action,   
                                                                     Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]   
                                                                     outs, TimeSpan timeout)                                                   
                                                                          at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMe
                                                                     thodCallMessage methodCall, ProxyOperationRuntime operation)              
                                                                          at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage  
                                                                     message)                                                                  

                                                                       Exception rethrown at [0]:                                              
                                                                          at                                                                   
                                                                     System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage    
                                                                     reqMsg, IMessage retMsg)                                                  
                                                                          at                                                                   
                                                                     System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&      
                                                                     msgData, Int32 type)                                                      
                                                                          at Microsoft.Dynamics.Nav.Types.IAdminService.OpenAdminConnection(Con
                                                                     nectionRequest connectionRequest)                                         
                                                                          at Microsoft.Dynamics.Nav.Management.ServerInstanceConnection.DoOpenA
                                                                     dminConnection(IAdminService adminService)               
freddydk commented 4 years ago

How do you specify the license file? A file on the host or a URL?

svengrav commented 4 years ago

Hi Freddy, thanks for the feedback.

The license is available locally.

My latest attempt:

New-NavContainer `
    -isolation "hyperv"  `
    -accept_eula `
    -containerName "TEST" `
    -artifactUrl (Get-BCArtifactUrl -type Onprem -country "de" -version 16.3) `
    -licenseFile "E:\Liz.flf"
freddydk commented 4 years ago

and what is the full output of a command like that?

svengrav commented 4 years ago

The full output is:

New-NavContainer `
    -isolation "hyperv"  `
    -accept_eula `
    -containerName "TEST2" `
    -artifactUrl (Get-BCArtifactUrl -type Onprem -country "w1" -version 16.0) `
    -licenseFile "E:\Liz.flf"

NavContainerHelper is version 0.7.0.23
NavContainerHelper is running as administrator
Host is Microsoft Windows 10 Enterprise - 1803
Docker Client Version is 19.03.5
Docker Server Version is 19.03.5
Fetching all docker images
Using image mcr.microsoft.com/dynamicsnav:10.0.17134.1130-generic
Downloading application artifact /onprem/16.0.11240.12085/w1
Downloading C:\Users\xgwsgrs\AppData\Local\Temp\e59603d0-0da6-4d82-ada6-1418b3ca0820.zip
Unpacking application artifact to tmp folder using Expand-Archive
Downloading platform artifact /onprem/16.0.11240.12085/platform
Downloading C:\Users\xgwsgrs\AppData\Local\Temp\e6f9312e-249b-4cb4-9211-6e219565d39a.zip
Unpacking platform artifact to tmp folder using Expand-Archive
Downloading Prerequisite Components
Downloading c:\bcartifacts.cache\onprem\16.0.11240.12085\platform\Prerequisite Components\Open XML SDK 2.5 for Microsof
t Office\OpenXMLSDKv25.msi
Downloading c:\bcartifacts.cache\onprem\16.0.11240.12085\platform\Prerequisite Components\Microsoft Report Viewer 2015\
ReportViewer.msi
Downloading c:\bcartifacts.cache\onprem\16.0.11240.12085\platform\Prerequisite Components\IIS URL Rewrite Module\rewrit
e_2.0_rtw_x64.msi
Downloading c:\bcartifacts.cache\onprem\16.0.11240.12085\platform\Prerequisite Components\Microsoft Report Viewer 2015\
SQLSysClrTypes.msi
Downloading c:\bcartifacts.cache\onprem\16.0.11240.12085\platform\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1
.1.1-WindowsHosting.exe
Creating Container TEST2
Version: 16.0.11240.12085-w1
Style: onprem
Platform: 16.0.11233.12078
Generic Tag: 0.1.0.7
Container OS Version: 10.0.17134.1130 (1803)
Host OS Version: 10.0.17134.1553 (1803)
Using locale en-US
Using hyperv isolation
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file E:\Liz.flf
Files in C:\ProgramData\NavContainerHelper\Extensions\TEST2\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container TEST2 from image mcr.microsoft.com/dynamicsnav:10.0.17134.1130-generic
e9bd8f4639420f792008f432a5659746712e17e38cf85894dbaaf6f1644429cd
Waiting for container TEST2 to be ready
Using artifactUrl https://bcartifacts.azureedge.net/onprem/16.0.11240.12085/w1
Copying Platform Artifacts
Copying Application Artifacts
Copying Database
Installing Business Central
Installing Url Rewrite
Installing OpenXML
Installing DotNetCore
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
Copying Web Client Files
Copying Client Files
Copying ModernDev Files
Copying PowerShell Scripts
Copying ConfigurationPackages
Copying Test Assemblies
Copying Applications
Copying ReportBuilder
Determining Database Collation
Changing Database Server Collation to Latin1_General_100_CS_AS
Restoring CRONUS Demo 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 401 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.29.0.1 in container hosts file
Starting Container
Hostname is TEST2
PublicDnsName is TEST2
WARNING: Container starts with TimeZone = Mitteleuropäische Zeit, which is not recognized in the list of TimeZones.
Using Windows Authentication
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using license file 'c:\run\my\license.flf'
Import License
The license file is corrupt. Error Code: -200.
at <ScriptBlock>, C:\Run\SetupLicense.ps1: line 29
at <ScriptBlock>, C:\Run\navstart.ps1: line 161
at <ScriptBlock>, C:\Run\start.ps1: line 223
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts.azureedge.net/onprem/16.0.11240.12085/w1
Copying Platform Artifacts
Copying Application Artifacts
Copying Database
Installing Business Central
Installing Url Rewrite
Installing OpenXML
Installing DotNetCore
Starting Local SQL Server
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
WARNING: Waiting for service 'SQL Server (SQLEXPRESS) (MSSQL$SQLEXPRESS)' to 
start...
Starting Internet Information Server
Copying Service Tier Files
Copying Web Client Files
Copying Client Files
Copying ModernDev Files
Copying PowerShell Scripts
Copying ConfigurationPackages
Copying Test Assemblies
Copying Applications
Copying ReportBuilder
Determining Database Collation
Changing Database Server Collation to Latin1_General_100_CS_AS
Restoring CRONUS Demo 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 401 seconds
Installation complete
Initializing...
Setting host.containerhelper.internal to 172.29.0.1 in container hosts file
Starting Container
Hostname is TEST2
PublicDnsName is TEST2
WARNING: Container starts with TimeZone = Mitteleuropäische Zeit, which is not recognized in the list of TimeZones.
Using Windows Authentication
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using license file 'c:\run\my\license.flf'
Import License
The license file is corrupt. Error Code: -200.
at <ScriptBlock>, C:\Run\SetupLicense.ps1: line 29
at <ScriptBlock>, C:\Run\navstart.ps1: line 161
at <ScriptBlock>, C:\Run\start.ps1: line 223
at <ScriptBlock>, <No file>: line 1
Initialization of container TEST2 failed
In C:\Program 
Files\WindowsPowerShell\Modules\navcontainerhelper\0.7.0.23\ContainerHandling\Wait-NavContainerReady.ps1:44 Zeichen:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization of container TEST2 failed:String) [], RuntimeExceptio 
   n
    + FullyQualifiedErrorId : Initialization of container TEST2 failed
freddydk commented 4 years ago

I have tried the same generic image, the same artifacts - cannot repro. I cannot try the same host OS - your host OS is very old and no longer supported (which is why you get a very old generic image). I would suggest that you update your host (although I don't think that is the issue). I also haven't tried your license - I would need the license file if I were to repro. If possible, you can email it to me (freddyk at microsoft dot com), then I will see if that is the problem.

Thanks

svengrav commented 4 years ago

Hello, Freddy,

thank you for your time. It seems that we used a sequence of faulty licenses which, at least for a local installation, did not result in an error message. We have now received a new license from the company and now the problem is solved. The containers are working again. We could not see a direct difference between the new and the old license, so its hard to say what exactly went wrong.

Sorry about the circumstances. Thanks again for the quick help. 👍😊

svengrav commented 4 years ago

Short info: It turned out that when downloading the license from the sharepoint the Chrome Browser corrupted the license. Since the license was then provided in DevOps for the pipelines, a subsequent error occurred when creating the containers.

freddydk commented 4 years ago

BTW Your host windows version is 1803 - that is an unsupported windows version and as such you might be running older containers etc. I would definitely recommend not running unsupported Windows versions.