Setting Up The Backend For The New M-Files Web and Web-Based Add-Ins
Setting Up The Backend For The New M-Files Web and Web-Based Add-Ins
VERSION 3.4
Contents
1. Version Information ............................................................................................................................................................ 3
2. Introduction ........................................................................................................................................................................ 3
4.2 vNext as a Web Application Under the Current M-Files Web Server ..................................................................... 10
vNext Backend Server Not Working After Updating M-Files Server to March '20 Update ................................................... 22
vNext Backend Server Not Working After Updating M-Files Server to January '20 Update ................................................. 22
1. Version Information
This document is for M-Files September '22 Update and earlier. If you use M-Files October '22 update or later and M-Files
Web has not been previously set up on the server, instead refer to Setting Up Web and Mobile Access to M-Files.
2. Introduction
This document tells you how to set up the backend server environment for the new M-Files Web (also called vNext or vNext-
based M-Files Web). In addition to M-Files Web, the backend service allows vNext-based add-ins (for example, for M-Files
Add-In for Teams and SharePoint Online) to connect to M-Files Server. The vNext web engine is included in the M-Files
server software package.
The document is intended for M-Files consultants and customer IT administrators who are setting up the new M-Files Web
and the above-mentioned add-ins.
2.1 Prerequisites
Before you continue with the setup, make sure that these prerequisites have been completed:
1. Open the Windows start menu, type in server manager, and open Server Manager.
2. In Server Manager, select Manage > Add Roles and Features.
3. Under Server Roles, make sure Web Server (IIS) is enabled.
4. Under Features, make sure .NET Framework 4.5 Features > .NET Framework 4.5 is enabled.
5. Under Web Server Role (IIS) > Role Services, make sure that these features are enabled:
o Web Server > Common HTTP Features
▪ Default Document
▪ Directory Browsing
The Internet Information Services (IIS) server is used as a reverse proxy server to expose the vNext backend server over a
secure protocol for public access. For this purpose, you need to install the URL Rewrite and Application Request Routing IIS
components as explained in this section.
The URL Rewrite component is a rule-based URL rewriting engine. It is used for transforming the public URL request into a
vNext backend server URL. Download the URL Rewrite extension and install it to the server computer. The download page
also provides a more exhaustive description of the component.
In addition to the URL Rewrite component, you need to install Application Request Routing Cache by following these steps:
1. Download the Application Request Routing extension and install it to the server computer.
2. Restart IIS.
a) Open the Windows command prompt as an administrator.
b) Type in and execute the following command:
iisreset /restart
3. Open Internet Information Services (IIS) Manager and select the server node.
5. Click the Server Proxy Settings… link under the Actions > Proxy section.
6. Under Actions, make sure that the Enable proxy checkbox is checked and select Apply.
You can keep the other settings as default, but if you want, you can edit them. For example, the Time-out (seconds) and the
Keep alive settings.
• In a single-server machine setup, the vNext server configuration and the IIS configuration are carried out on the
same machine.
• In proxy-application server model with a separate server for IIS and the M-Files application, the IIS configuration is
carried out on the proxy server and the CORS configuration on the application server.
Image 1: In a proxy-application server model, the IIS configuration is carried out on the proxy server and the CORS configuration on the
application server.
If you are configuring the vNext backend server as a completely new installation, follow the instructions in section 4.1.
Alternatively, if you want to configure vNext to run based on your current M-Files Web deployment, see section 4.2 instead.
Note: If you are using a proxy–application server model, update the url value of the action element in the
vNext.config file with your application server URI and complete the IIS configuration on the proxy server
machine. Use the port number 7767 for the application server. For more information, see the definition for
GRPCWEBPORT in M-Files Web Specific Settings.
Note: The backend server must use the same connection protocol (HTTP or HTTPS) as the add-in host
environment.
If you do not yet have an SSL certificate available, you can find instructions for creating and configuring SSL
certificates on the Internet. Refer to, for instance, this Digicert article.
4. Copy the attached configuration, vNext.config, into a physical location (for example C:\MFilesWeb_vNext).
5. Rename the file to web.config.
The name of the attached configuration is vNext.config to distinguish it from an earlier version of the file.
6. Specify that file location as the physical path of the site.
You can open the Edit Site dialog by selecting the site and then clicking Basic Settings… in the right-side Actions area.
Note: If you are using a proxy–app server model, enter the URL of the application server to the
Rewrite URL field instead of localhost.
iv. In the Edit Rewrite Map window, under the Action section, select Add Mapping Entry… and create
two entries according to the examples below.
Note: In some cases, you may need to restart the IIS server machine for the configuration to take effect.
4.2 vNext as a Web Application Under the Current M -Files Web Server
You can alternatively configure the vNext server as a new web application under your current M-Files Web site by following
the instructions below, or by using the ConfigurevNextServerUndervCurrent.ps1 PowerShell script that is part of
the same multi-file document as this guide. The PowerShell script is designed for cloud server deployments.
Important: Before running the script, modify the value of the $mfilesFolder variable to point to your M-Files
installation directory (for example C:\Program Files\M-Files). Additionally, make sure the example
Default Web Site value refers to your website name (check the website name from IIS Manager).
1. In Internet Information Services (IIS) Manager, right-click the current M-Files Web server site (for example Default
Web Site).
3. Copy the attached configuration, vNext.config, into a physical location (for example C:\MFilesWeb_vNext).
4. Rename the file to web.config.
The name of the attached configuration is vNext.config to distinguish it from an earlier version of the file.
5. Specify that file location as the physical path of the site.
Note: The default contents of the vNext.config file and using localhost as the URL apply only when the
environment is set up on one computer. If you have M-Files Server on a different computer, you must use the
URL of the M-Files Server when defining the settings.
iv. In the Edit Rewrite Map window, under the Action section, select Add Mapping Entry… and create
two entries according to the examples below.
v. Under the Actions section, select View Rewrite Maps…
vi. In the View Rewrite Maps window, under the Action section, select Add Rewrite Map…
vii. Enter MapProtocol as the map name, and click OK.
viii. In the Edit Rewrite Map window, under the Action section, select Add Mapping Entry… and create
two entries according to the examples below.
Note: In some cases, you may need to restart the IIS server machine for the configuration to take effect.
Configure the authentication mode of the vNext backend server by following the instructions below, or by using the
ConfigurevNextServerUndervCurrent.ps1 PowerShell script that is part of the same multi-file document as this
guide. The PowerShell script is designed for cloud server deployments.
1. In Internet Information Services (IIS) Manager, select the vNext site or application depending on your vNext backend
server configuration method, and open the Configuration Editor section.
2. Enter the following text to the Section field and press Enter to open the Windows authentication settings for vNext
backend server: system.webServer/security/authentication/windowsAuthentication
3. Set the enabled property to False and click Apply in the right-side Actions area.
4. Enter the following text to the Section field and press Enter to open the anonymous authentication settings for vNext
backend server: system.webServer/security/authentication/anonymousAuthentication
6. Enter the following text to the Section field and press Enter to open the Allowed Server Variables settings for vNext
backend server: system.webServer/rewrite/allowedServerVariables
7. Click Edit Items in the right-side Actions area.
Result: The Collection Editor dialog is opened.
8. Create the following server variables via the Add button:
o HTTP_X_FORWARDED_PROTO
o HTTP_X_FORWARDED_HOST
9. When you are finished, click Apply in the right-side Actions area of main window.
You can ensure the server connection is working as expected by doing the following steps:
Note: In a proxy–application server model, complete this step on the application server machine.
To set up OAuth 2.0 based authentication for M-Files Web or the add-ins, refer to Setting Up OAuth 2.0 for the New M-Files
Web and Web-Based Add-Ins.
If you are setting up the vNext backend for M-Files add-ins such as M-Files Add-In for Teams and SharePoint Online and
M-Files Add-In for Salesforce CRM, and you are using M-Files March '20 Update or later, please see the separate installation
instructions for the add-in. If you are using M-Files February '20 Update or earlier, please see the section Settings for Cross-
Origin Resource Sharing before installing the add-in.
9. Change History
1.1 2019/04/12 Added a note about the M-Files Online requirement to the introduction.
1.2 2019/04/17 Updated step 7 under section 4 as well as the version requirement in section 2.1.
1.3 2019/05/23 M-Files Server requirement updated. Section 4 divided into two separate scenarios. Download links
added to sections 3.1 and 3.2. Added detailed instructions for creating an inbound rule.
1.4 2019/06/07 Added the troubleshooting section and a note about port changes in M-Files June '19 Update.
1.7 2019/09/16 Added the authentication configuration section 3.4 and referred this in section 3.3.1. and in 3.3.2.
1.8 2019/10/14 Added notes in section 4.2 and Appendix A: Additional Settings.
2.1 2020/01/14 Updated section 5, vNext.config and PowerShell scripts for configuring Allowed Server Variables.
2.3 2020/02/26 The documentation now uses a more suitable template. Multiple changes throughout the document.
Instructions for validating the server setup added.
2.4 2020/03/09 Updated sections 4.1, 4.2, Appendix A and Appendix B. Added section 7. Added a note to the
prerequisites section.
2.6 2020/05/07 Added a design diagram for the proxy-app model to section 4. Updated section 6, Appendix A and
Appendix B.
3.0 2020/12/15 The document now has a section for setting up OAuth 2.0 authentication.
3.1 2021/12/22 Added the requirement for the IIS feature WebSocket Protocol to section 2.1.
3.3 2022/10/17 The new M-Files Web can now be set up with M-Files Admin. Updated the start of the document.
• IIS 8 and IIS 8.5: Create CSR and Install SSL Certificate (Digicert article)
• URL Rewrite (IIS.NET article)
• Application Request Routing (IIS.NET article)
This section lists additional, optional registry settings for M-Files vNext configurations.
Note: If you are using a proxy–app server model, configure the registry settings listed in this section on the app
server machine.
If you are using M-Files February '20 Update or earlier, the settings listed here need to be set for M-Files add-ins (like M-Files
Add-In for Teams and SharePoint Online and M-Files Add-In for Salesforce CRM) to work as required.
The cross-origin resource sharing (CORS) settings define domains that can be accessed from M-Files add-in. They are added
under the following key:
Key HKEY_LOCAL_MACHINE\SOFTWARE\Motive\M-Files\<version>\Server\MFServer\Http\AccessControl
Description The allowed cross-origin domain URLs for the host application. Separate multiple values with a comma and
do not add a whitespace after the comma (see the value definition below). Do not add slash to the end of
the URL.
Note: The Teams integration uses the SharePoint web part, which is why the Teams domain
does not need to be listed in this setting.
Description The allowed cross-frame domains URLs for the host application when the PreventXFS setting is set to
true. Separate multiple values with a comma and do not add a whitespace after the comma (see the
value definition below).
Specify the URLs of your M-Files vNext server and SharePoint domain. Add the Teams domain as well to
use the Teams integration for cross-frame access. Do not add a subdirectory name (for example /vnext)
or a slash to the end of the URL.
Description Specifies whether to prevent access from cross-frame sites. If this is set to "false", there is no need to set
the AllowedCrossFrameSites setting, either. Only set this to "false" if you have specific reason to do
so.
Value true
Allowed • true
values • false
Description The methods that need to be allowed in the response headers. Separate multiple values with a comma (,)
and do not add a whitespace after it (see the value definition below).
Value GET,OPTIONS,POST
Description The headers that need to be allowed in the response. Separate multiple values with a comma and do not
add a whitespace after it (see the value definition below).
Value Origin,X-Requested-With,Content-Type,Accept,M-Files-Vault,m-files-session,m-
files-extensions
Description Indicates whether the user agent should send cookies from the other domain in the case of cross-origin
requests. This setting is required for embedded apps like M-Files Add-In for Teams and SharePoint Online
to be able to pass cookies for server requests.
Value true
Allowed • true
values • false
Key HKEY_LOCAL_MACHINE\SOFTWARE\Motive\M-Files\<version>\Server\MFServer
Description Make sure the server firewall allows inbound connections to the specified port. If the default port is
allocated to another service in your environment, you can change the port via this setting.
Note: If you are defining the setting in Registry Editor, save the value with decimal base.
Note: If you have modified the setting to something else than 7767, use this port number when
configuring the vNext Backend server.
To make your server more secure, filter HTTP traffic to the M-Files server machine that comes in through the gRPC port
specified with the GRPCWEBPORT registry key. For example, only let in traffic from the same machine if the IIS server is on the
same computer as the M-Files server, or from a specific IIS server if it runs on another machine.
vNext Backend Server Not Working After Updating M -Files Server to March '20 Update
Important: In on-premises environments where each vault has not been designated a VaultDNS value under
HKEY_LOCAL_MACHINE\SOFTWARE\Motive\M-Files\<version>\Server\Common\VaultDNSConfig, please first
upgrade to M-Files April '20 Update and then follow the instructions indicated below.
Your vNext deployment may stop working after your M-Files Server is updated to M-Files March '20 Update. If you
encounter this issue:
Note: Once you have upgraded your environment successfully, remove the following CORS setting from the
Windows registry of the application server:
HKEY_LOCAL_MACHINE\SOFTWARE\Motive\M-Files\<version>\Server\MFServer\Http\AccessControl
In a multi-tenant environment, ensure that each vault contains their own configuration values (URLs configured)
in M-Files Admin under Configurations > Advanced Vault Settings > M-Files Add-In Settings.
Note: You can use the updated script with earlier M-Files Server versions as well.
vNext Backend Server Not Working After Updating M -Files Server to January '20 Update
Your vNext deployment may stop working after your M-Files Server is updated to M-Files January '20 Update. If you
encounter this issue, run the ConfigurevNextServerUndervCurrent.ps1 script that is part of the same multi-file document as
this guide. This updated version of the script fixes an issue related to the location of the M-Files installation directory.
Note: You can use the updated script with earlier M-Files Server versions as well