.net - CLR assembly will not load in 64 bit SQL Server 2005 -
We use an assembly with some user-defined functions in our installation of SQL Server 2005 (32 bit). We deployed this to produce with a script like this.
Build [Ourfunctions] Authorization [dbo] PERMISSION_SET = Secure GO Create Function [dbo] 000 to [GLOBAL_FormatString] (@input [nvarchar] (4000)) with 0x4D5A9000 ... External name [Ourfunctions] as executed in CALLER form with [nvarchar] (4000) [UserDefinedFunctions] [GLOBAL_FormatString] GO
We have never experienced any problems with these tasks. Now, when we tried to upgrade one of our servers to X64, Also, errors were found while calling the job. Sample Stack Trace:
System.Data.SqlClient.SqlException: An error occurred in the Microsoft .NET Framework Assembly ID 65549. Loading may be running out of server resources , Or the assembly can not be trusted by trying the PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE query again, or check the documentation to resolve assembly issues. System.IO.FileLoadException: This error could not load the file or assembly for more information about ourfunctions, version = 0.0.0.0, culture = neutral, publicKeyToken = null 'or one of your dependencies. The name or codebase of the given assembly was invalid. (Exception from HRESULT: 0x80131047) System. IoFile Load Exception: On System. Refining Assembly. File name, String Codebase, Evidence assembly security, Assembly LocationHinter, Stack crawl mark and Stack marker, Boolean throwoverfileNotFound, Boolean-snip -
Error mention permission set .dll file with the target platform set to 'any CPU' And when we have made DRA If we try to load del from the file instead of the varbinary syntax, then we get the same result. We are already trying the suggestions in a 32 bit machine and everything worked on Have tried the exact same process, it should be a difference between x86 and x64. Any idea solution: ..? We did not get the solution in the end, it is found in our assembly that actually a 32 Bit was compiled. In Udio, we target "anyone had used the CPU", but J. Upon inspection of the underlying .cspro, I found the following snippet: So our "no CPU" goal was actually building an x86 assembly! Aaargh I have searched this line back in subversion, but it was already on the first checkin in 2006. Maybe this was a bug in some of the initial templates of the database project? However, thanks for your help, I will accept Russ's reply, because I suspect that many people who experience this problem will get the most help from their reply. EXTERNAL_ACCESS
and unsafe
while we are level safe .
& lt; Asset group status = "'$ (configuration) | $ (platform)' == 'debug | sccpu'" & gt; ... other elements ... & lt; PlatformTarget & gt; X86 & lt; / PlatformTarget & gt; & Lt; / PropertyGroup & gt;
Do not have to do with the fact that this is 64 bits, to allow you to change the DB is required. Try it out:
Set trust set trustworthy on the database;
If it does not work alone, then you can try these options as well.
uradadabaseair ga sp_configure 'show advanced options' , 1; Go RECONFIGURE; Geo SP_configure 'wet automation process', 1; Go RECONFIGURE; Go
Comments
Post a Comment