Creating new instances of Business Central web servers using PowerShell
Although you can use the Business Central Setup to install the Business Central Web Server components and create a single web server instance in IIS for client connection, there may be scenarios when you want to set up multiple instances.
For example, you could set up a separate Business Central Web Server instance for the different companies of a business, for this scenario, you can use the Business Central Web Server PowerShell cmdlets.
#1 – HOW TO CREATE\ADD NEW WEB SERVERS?
The Business Central Administration Shell includes cmdlets for administering Business Central Web Server instances for the web client. These cmdlets are included in the NAVWebClientManagement script module that is installed as part of the Business Central Administration Shell when you install the Business Central Web Server components.
Web Client Distribution Folder
You can copy Web Client distribution from Business Central DVD or from Web Client installation folder.
ex: copy from Web Client folder ex: “C:\Program files\Business Central\150\Web Client\WebPublish” or from DVD example: “DVD\WebClient\Business Central\150\Web Client\WebPublish”
#OPTION1 – Create a Subsite (ex: on existing container “Microsoft Dynamics 365 Business Central Web Client”) ex: BC150IT
RootSite Instance
“A RootSite instance is a root-level web site that is complete with content files for serving the Business Central Web client. It is configured with its own set of bindings for accessing the site, such as protocol (http or https) and communication port.”
The structure in IIS looks like this:
- Sites
- BusunessCentralWebSite (web site)
-
nn-NN (language versions)
-
www (content)
navsettings.json
Cmdlet
New-NAVWebServerInstance -WebServerInstance BC150T0WEB -Server localhost -ServerInstance BC150 -SiteDeploymentType Subsite -ContainerSiteName “Microsoft Dynamics 365 Business Central Web Client” -WebSitePort 8080 -PublishFolder “C:\WebPublish”
#OPTION2 – Create a new site root (ex: BC150IT)
Subsite instance
“A SubSite instance is a web application that is under a container web site. The container web site is configured with a set of bindings, but the site itself has no content files. The content files are contained in the application (SubSite)”
The structure in IIS for two instances looks like this in IIS:
- Sites
-
BusunessCentralWebSite (web site)
-
BusinessCentralWebInstance1 (application)
-
nn-NN (language versions)
-
www
navsettings.json
…
- BusinessCentralWebInstance2 (application)
-
nn-NN (language versions)
-
www
navsettings.json
…
Cmdlet
New-NAVWebServerInstance -WebServerInstance BC150WEB -Server localhost -ServerInstance BC150 -SiteDeploymentType RootSite -WebSitePort 8081 -PublishFolder “C:\WebPublish”
About -NAVWebServerInstance cmdlet
-NAVWebServerInstance
New-NAVWebServerInstance
[-WebServerInstance] <String>
[-Server] <String>
[-ServerInstance] <String>
[[-ClientServicesCredentialType] <String>]
[[-ClientServicesPort] <Int32>]
[[-ContainerSiteName] <String>]
[[-WebSitePort] <Int32>]
[[-PublishFolder] <String>]
.. and other options
#2 – ABOUT THE “navsettings.json” FILE
About the configuration file
The configuration file for the web server instances is a .json file type called “navsettings.json“. The navsettings.json file is a Java Script Object Notification file type that is similar to files that use the XML file format.
Where to find the navsettings.json file?
The navsettings.json file is stored in the physical path of the web server instance, which is by default is %systemroot%\inetpub\wwwroot[WebServerInstanceName]
The navsettings.json has the following structure, where settings are included under one of two root elements: NAVWebSettings and ApplicationIdSettings:
{
“NAVWebSettings”: {
“//ServerInstance”: “Name of the Business Central Server instance to connect to (for client) or listen on (for server).”,
“ServerInstance”: “BC150”,
[…more keys]
},
“ApplicationIdSettings”: {
“BlogLink”: “https://myBCBlog.com”,
[…more keys]
}
}