Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CLR Assemblies in Replication Expand / Collapse
Author
Message
Posted Wednesday, March 3, 2010 12:21 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, August 22, 2013 2:22 PM
Points: 39, Visits: 190
I have a 64-bit assembly in my publication, and a function that accesses it.
ex.
USE [MyPublication]
GO
CREATE ASSEMBLY MyTestAssembly
FROM 'C:\MyTestAssembly.dll'
GO
CREATE FUNCTION [dbo].[MyTestFunction](@text nvarchar(MAX))
RETURNS nvarchar(MAX)
AS EXTERNAL NAME MyTestAssembly.TestFunction
GO

Each subscriber has its own "C:\MyTestAssembly.dll", if it's a 32-bit subscriber, they have a 32-bit version of the assembly, if they're a 64-bit subscriber, they have a 64-bit version of the assembly.

When I initialize a subscriber, it initializes correctly, but when I run "SELECT [dbo].[MyTestFunction]('foo')", I get:

Msg 10314, Level 16, State 11, Line 1
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65537. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly 'mytestassembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
System.IO.FileLoadException:
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)

I'm assuming that this problem is because the target assembly on the subscriber is not the same 64-bit version that's on the publisher. Is that correct? Is there any way to have this working without requiring a custom script to run on each subscriber after they're initialized?
Post #875712
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse