We have SQL Server 2008 r2 installed on a server (SqlServ
). A database on it has a Merge publication, and subscribers contact it through replisapi.dll installed on a different server (WebServ
).
We need to implement a custom conflict resolver for some of the published tables, using .NET.
I've followed the instructions on How to: Implement a Business Logic Handler for a Merge Article (Replication Programming) and I've created a .NET library to handle the conflicts.
The article linked above has the following instruction:
Deploy the assembly in the directory that contains the Merge Agent executable file (replmerg.exe), which for a default installation is C:\Program Files\Microsoft SQL Server\100\COM, or install it in the .NET global assembly cache (GAC). You should only install the assembly in the GAC if applications other than the Merge Agent require access to the assembly. The assembly can be installed into the GAC using the Global Assembly Cache tool (Gacutil.exe) provided in the .NET Framework SDK.
Note
A business logic handler must be deployed on every server on which the Merge Agent runs, which includes the IIS server that hosts the replisapi.dll when using Web synchronization.
If I understood correctly, the .dll file has to be installed on both SqlServ
and WebServ
. I have done so, and I can confirm it's in the GAC on both servers. In case it matters, the method I used was to create a Setup project in Visual Studio and run it on the servers.
I've also registered the resolver using sp_registercustomresolver
and have selected it for the relevant articles in Publication Properties.
Attempting to synchronise a subscription fails with the following error:
Error loading custom assembly "CustomResolver", Error : "Could not load file or assembly 'CustomResolver' or one of its dependencies. The system cannot find the file specified.". (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147467259) Get help: http://help/MSSQL_REPL-2147467259
So it seems what I've done is not enough.
I've attempted to add it as a module on the IIS server on WebServ
, but the assembly does not appear in the drop-down list in the setting window.
I found the following question: Registering a Custom Module in IIS 7
According to the above, adding the .dll to the GAC should be enough to make it appear. Also, a comment on the accepted answer indicates that it should use the same version of the .NET Framework as the Site. The Application Pool for that site uses v2.0, and so does the .dll, so there doesn't seem to be a problem there.
If I force it to add the module anyway (ignoring that it can't find it), synchronisation hangs before anything even appears in Replication Monitor.
My question is:
If it's required to add the custom resolver as a module on the IIS site used for synchronisation, what more do I have to do to make it appear in the list?
If installing it in the GAC of both servers is enough, why does synchronisation fail?