Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling CLR still doesn't allow me to run code on sql server

I'm using the following command to try and enable the CLR on a SQL Server 2008 instance

EXEC sp_configure 'clr enabled', 1
GO

RECONFIGURE
GO

But I still get the following error

Execution of .NET Framework code is disabled. Set "clr enabled" configuration option and restart the server

Do I need to do anything else?

like image 751
Shazoo Avatar asked Feb 02 '16 13:02

Shazoo


1 Answers

To review what has been checked and attempted so far:

  1. EXEC sp_configure 'clr enabled', 1; has been executed.

  2. RECONFIGURE; has been executed.

  3. The server has been restarted. This should only be necessary on WOW64 servers.

  4. Running EXEC sp_configure 'clr enabled'; shows a 1 for run_value.

  5. Running EXEC sp_configure 'lightweight pooling'; shows a 0 for run_value.

  6. state property in sys.dm_clr_properties has a value of "Locked CLR version with mscoree", meaning:

    The Locked CLR version with mscoree state may be seen where the hosted CLR is not being used and, thus, it has not yet been initialized. The hosted CLR is initialized the first time a DDL statement (such as CREATE ASSEMBLY (Transact-SQL)) or a managed database object is executed.

Additional things to try / check:

  1. Make sure that .NET Framework 2.0 and 3.5 SP1 are installed
  2. Make sure that .NET Framework patches have been applied through Windows Update
  3. Possibly make sure, in Control Panel\Programs\Programs and Features that "Microsoft SQL Server System CLR Types" is installed
  4. Check your authentication type. If set to "both", try change to "Windows Only", restarting the SQL Server service, and see if that helps. Not a good long-term solution, but might point in a direction.
  5. What account is the MSSQLSERVER service logging on as? There are some reports that "Network Service" or "NT AUTHORITY\Network Service" might have issues and that Local System account might be preferred.
  6. ??
like image 150
Solomon Rutzky Avatar answered Nov 15 '22 00:11

Solomon Rutzky