Troubleshooting Guide: SQL Server Error 6554 – “SQL Assembly Name” Error
Why This Error Happens
Error 6554 occurs when SQL Server’s CLR (Common Language Runtime) integration encounters an assembly that fails validation due to a mismatch in permission sets, such as attempting to load an UNSAFE or EXTERNAL_ACCESS assembly without the proper trust configuration. This is commonly triggered by the TRUSTWORTHY database setting being disabled or the assembly lacking a valid strong-name signature with a corresponding asymmetric key or certificate mapped to a login with UNSAFE ASSEMBLY permission. Corrupted or incompatible assembly binaries compiled against a different .NET runtime version than what SQL Server 2025 supports can also trigger this failure.
Step-by-Step Resolution Guide
Step 1: Verify Database Trustworthy and CLR Settings
- Open SQL Server Management Studio (SSMS) and connect to your Windows Server 2025 instance.
- Run the following to check CLR status:
sp_configure 'clr enabled';
- If disabled, enable it:
sp_configure 'clr enabled', 1;
RECONFIGURE;
- Check if the database is marked trustworthy:
SELECT name, is_trustworthy_on FROM sys.databases WHERE name = 'YourDatabaseName';
Step 2: Fix Assembly Permission Set Mismatch
- Avoid setting
TRUSTWORTHY ONin production; instead, use a signed assembly with a certificate. - Create an asymmetric key from the assembly DLL on disk:
CREATE ASYMMETRIC KEY MyAsmKey
FROM EXECUTABLE FILE = 'C:\Assemblies\YourAssembly.dll';
- Create a login from this key and grant the required permission:
CREATE LOGIN MyAsmLogin FROM ASYMMETRIC KEY MyAsmKey;
GRANT UNSAFE ASSEMBLY TO MyAsmLogin;
Step 3: Re-register or Re-deploy the Faulty Assembly
- Drop the problematic assembly if it already exists:
DROP ASSEMBLY YourAssemblyName;
- Re-create the assembly explicitly specifying the correct permission set:
CREATE ASSEMBLY YourAssemblyName
FROM 'C:\Assemblies\YourAssembly.dll'
WITH PERMISSION_SET = EXTERNAL_ACCESS;
- Ensure the DLL file is not blocked by Windows (right-click the file in File Explorer → Properties → check “Unblock” if present).
Step 4: Validate .NET Runtime Compatibility
- Confirm the assembly was compiled against a CLR version supported by SQL Server 2025 (.NET Framework 4.8 or the compatible CLR runtime bundled with SQL Server 2025).
- Use
corflags.exe(from Visual Studio Developer Command Prompt) to inspect the DLL’s target runtime version if unsure. - Recompile the assembly targeting the correct framework version if a mismatch is found.
Alternative or Verification Steps
- After redeployment, run
SELECT * FROM sys.assemblies WHERE name = 'YourAssemblyName';to confirm the assembly loads without error and shows the correctpermission_set_desc. - If the issue persists, as a temporary diagnostic workaround (not recommended long-term), set
ALTER DATABASE YourDatabaseName SET TRUSTWORTHY ON;to isolate whether the issue is permission-based versus a corrupted binary.