M-Files API version and CLR Assembly update
The M-Files APIs is loaded into the Connector Database as part of the assemblies of each database. It is required to ensure that the API version of the M-Files Client on the SQL Server remains the same as the API version in the assemblies of the Database. When the M-Files Client on the SQL Server is upgraded to assemblies will go out of sync and the Connector will stop working.
Version 4.3.9.48 introduced an new method of automatically monitoring the M-Files version change and updating the assemblies.
An agent is created during installation to run every day. This agent will check the installed M-Files version on the SQL server using spMFCheckAndUpdateAssemblyVersion. If the M-Files version changed, the MFSettings table is updated and the procedure spMFUpdateAssemblies are executed.
The procedure spMFUpdateAssemblies can be executed manually to update the assemblies.
MFSQL Connector will fail if the M-Files API (M-Files version specific) changes without updating the assemblies in the database.
Prerequisites and security
The Connector relies on SQL CLR to host the M-Files .NET/COM interop. Ensure the following on the SQL Server hosting the Connector database:
CLR is enabled:
-- Requires sysadmin permissions sp_configure 'show advanced options', 1; RECONFIGURE; sp_configure 'clr enabled', 1; RECONFIGURE;
- Permission set: Connector assemblies require
UNSAFE
due to COM interop with M-Files APIs.
- Permission set: Connector assemblies require
- SQL Server 2017+ strict security: With
clr strict security
enabled by default, assemblies are treated as UNSAFE unless trusted. Prefer either of:
Sign the assembly and create a login from the certificate, granting
UNSAFE ASSEMBLY
.Whitelist the assembly by hash using
sys.sp_add_trusted_assembly
.
- SQL Server 2017+ strict security: With
- Avoid setting the database
TRUSTWORTHY
option ON; use signed/trusted assemblies instead.
- Avoid setting the database
See also: Using CLR.
Troubleshooting after M-Files upgrades
If assembly loading fails after an M-Files client upgrade on the SQL Server:
Run spMFCheckAndUpdateAssemblyVersion or spMFUpdateAssemblies.
- Re-establish trust for the updated assembly if
clr strict security
is enabled (the binary hash will have changed). Re-sign or re-run
sp_add_trusted_assembly
as appropriate.
- Re-establish trust for the updated assembly if
Confirm
'clr enabled'
remains set to 1.
Type |
Description |
---|---|
Procedure Name |
spMFUpdateAssemblies |
Inputs |
Debug: 1 = Debug Mode; 0 = No Debug (default) |
Outputs |
1 = success |