views:

32

answers:

1

My 32bit .NET application runs SQL 2005 Express SP3 and uses CLR. The install works fine on XP & Vista. The install fails on XP 64bit & Widows 7 64bit machines.

The error is in one of my SQL scripts that creates an Assembly:

Error: “Execution of .NET Framework code is disabled. Set ‘CLR enabled’ configuration option and restart server. (5847)”

Script Code: CREATE ASSEMBLY MyCode FROM 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MyCode.dll' WITH PERMISSION_SET = UNSAFE

HOWEVER when I check the CLR it is enabled. In fact my very first script turns the CLR On and Trustworthy On.

So again, this all works on 32bit machines but not on 64bit.

Suggestions?

+1  A: 

On WoW64 (x86 Express instance installed on x64 host OS) you need to restart the instance for the CLR enabled to take effect, see clr enabled Option:

WOW64 servers must be restarted before the changes to this setting will take effect. Restart is not required for other server types.

Remus Rusanu
WOW! This is a surprise. Do you know of a way to set CLR On before the install starts the server?Thanks for the great info...
No way afaik. You need to install, and right after the install finishes, run sp_configure to enable clr, then recycle the MSSQL$SQLEXPRESS service via ServiceController.Stop()/Start()
Remus Rusanu
Or you could install the x64 .msi of Express to start with.
Remus Rusanu
I appreciate your help on this. I’ve spread this problem across many forums with no results. You’re quite the expert!
After I've been burned by this Wow64 restart issue for the thousanth time, I kinda learn it :)
Remus Rusanu