編集

次の方法で共有


Setting Up Multiple Business Central Web Server Instances 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 might 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, which are outlined in the following table.

Cmdlet Description
New-NAVWebServerInstance Creates a new Business Central Web Server instance and binds this instance to a Business Central Server instance.
Set-NAVWebServerInstanceConfiguration Specifies configuration values for a named Business Central Web Server instance.
Get-NAVWebServerInstance Gets the information about the Business Central Web Server instances that are registered on a computer.
Remove-NAVWebServerInstance Removes an existing Business Central Web Server instance.

Get started with the Business Central Web Server cmdlets

The Business Central Web Server cmdlets are contained in the PowerShell script module NAVWebClientManagement.psm1, which is available on the Business Central installation media (DVD).

The module is installed with the Business Central Server or the Business Central Web Server components.

There are different ways to launch this module and start using the cmdlets:

  • If you're working on the computer where the Business Central Server was installed, run the Business Central Administration Shell as an administrator.

    For more information, see Business Central PowerShell Cmdlets.

  • Otherwise, start Windows PowerShell as an administrator, and use the Import-Module cmdlet to import the NAVWebClientManagement.psm1 file:

    Import-Module -Name [filepath]
    

    For example:

    Import-Module -Name "C:\Program Files\Microsoft Dynamics 365 Business Central\NNN\Service\NAVWebClientManagement.psm1"
    

    Replace NNN with the Business Central Server instance folder name, like 240. Learn more about cmdlets at the Windows PowerShell docs.

Creating Business Central Web Server instances

Get Access to the WebPublish folder

To create a new web server instance, you need access to the WebPublish folder that contains the content files for the Business Central Web Server components.

  • This folder is available on the Business Central installation media (DVD) and has the path "DVD\WebClient\Microsoft Dynamics NAV\NNN\Web Client\WebPublish". NNN indicates the Business Central version like 240 or 230.

  • This folder has the path "C:\Program Files\Microsoft Dynamics 365 Business Central\NNN\Web Client\WebPublish" if you installed the Business Central Web Server components.

You can use either of these locations or you can copy the folder to more convenient location on your computer or network.

Decide on the site deployment type for the instance

When you create a new Business Central Web Server instance, you can choose to create either a RootSite or SubSite type. Each instance type has a different hierarchical structure in IIS, which influences its configuration and the URLs for the accessing from the Business Central Web client.

RootSite

A RootSite instance is a root-level web site that is complete with content files for serving the Business Central Web client. It's 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
  - BusinessCentralWebSite (web site)
    + nn-NN (language versions)
    + www (content)
    navsettings.json
    ...

The Business Central Web client URL for the RootSite instance has the format:

https://[WebserverComputerName]:[port]

For example: https://localhost:8080.

SubSite

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 SubSite inherits the bindings from the container web site. This deployment is the deployment type that is created when you install Business Central Web Server components in the Setup wizard. Using the New-NAVWebServerInstance cmdlet, you can add multiple SubSite instances in the container web site. The structure in IIS for two instances looks like this in IIS:

- Sites
  - BusinessCentralWebSite (web site)
    - BusinessCentralWebInstance1 (application)
      + nn-NN (language versions)
      + www 
      navsettings.json
      ...
    - BusinessCentralWebInstance2 (application)
      + nn-NN (language versions)
      + www
      navsettings.json
      ...

The Business Central Web client URL of a SubSite instance is longer than a RootSite because it also contains the application's alias (or virtual path) for the instance, which you define. The URL for a SubSite instance has the format:

https://[WebserverComputerName]:[port]/[WebServerInstance]

For example: https://localhost:8080/BusinessCentralWebInstance1 and https://localhost:8080/BusinessCentralWebInstance2.

Run the New-NAVWebServerInstance cmdlet

At the command prompt, run the New-NAVWebServerInstance cmdlet. The following are simple examples for creating a RootSite and SubSite deployment type.

RootSite example:

New-NAVWebServerInstance -WebServerInstance MyBCWebsite -Server MyBCServer -ServerInstance MyBCServerInstance -SiteDeploymentType RootSite -WebSitePort 8081 -PublishFolder "C:\Web Client\WebPublish"

SubSite example:

New-NAVWebServerInstance -WebServerInstance MyWebApp -Server MyBCServer -ServerInstance MyBCServerInstance -SiteDeploymentType Subsite -ContainerSiteName MySiteContainer -WebSitePort 8081 -PublishFolder "C:\WebClient\WebPublish"
  • Substitute MyBCWebsite with the name that you want to give the web application in IIS for the web server instance. If you're creating a SubSite deployment type, this name becomes part of the URL for opening the Business Central Web client application, for example, https://MyWebServer:8081/MyWebApp.

  • Substitute MyBCServer to the name of the computer that is running the Business Central Server to which you want to connect.

  • Substitute MyBCServerInstance with the name of the Business Central Server instance to use.

  • Substitute MySiteContainer with name of the container web site under which you want to add the instance. If you specify a name that doesn't exist, a new container web site containing the new web server instance is created.

  • Substitute 8081 with the port number that you want to bind the instance to. If you don't specify a port number, then port 80 is used.

  • Substitute C:\WebClient\WebPublish with the path to your WebPublish folder. By default, the cmdlet uses in the 'C:\Program Files\Microsoft Dynamics 365 Business Central\NNN\Web Client' folder. So if you omit this parameter, make sure that default folder path includes the Business Central Web Server components version that matches the Business Central Server instance.

Note

This command only sets the required parameters of the New-NAVWebServerInstance cmdlet. The cmdlet has several other parameters that can use to configure the web server instance. Learn more at New-NAVWebServerInstance.

Modifying a Business Central Web Server instance

After you create the web server instance, if you want to change its configuration, you can use the Set-NAVWebServerInstanceConfiguration cmdlet. Or, you can modify the configuration file (navsettings.json) of the instance directly. Learn more in Configuring Web Server Instances.

Business Central Web Server Overview
Configuring Web Server Instances