Oszkar
Oszkar

Reputation: 682

I cannot use WCF in SQL CLR 2012

When adding my assemblies to SQL Server 2012, dependencies draw in system.servicemodel which draws in microsoft.visualbasic.activities.compiler, and that bring the following error:

CREATE ASSEMBLY for assembly '<assembly name>' failed because assembly 'microsoft.visualbasic.activities.compiler' is malformed or not a pure .NET assembly. 
Unverifiable PE Header/native stub.

It seems that WCF DLLs cannot be added to SQL Server 2012.

Is there a workaround? Is this fixed in SQL Server 2014?

Upvotes: 1

Views: 1199

Answers (1)

Stefan Steiger
Stefan Steiger

Reputation: 82186

No, SQL-Server only allows a rather limited subset of C#, for security reasons.
For example, adding a reference to System.Web is sufficient that it doesn't work.

Perhaps you can rip the part of System.ServiceModel that you need out of the mono sourcecode and get it to work that way. With luck, if you need only one or two function calls, so you can get it to work with a few changes.

On a sidenote: If you could add WCF in a CLR-Stored Procedure, you could make SQL-Express use HTTP-Endpoints. But one of the defining limitations of SQL-Server Express is, that the Express version doesn't allow that. If that was possible, you could circumvent that limitation, and Microsoft certainly doesn't want that.

See also this post:
WCF Client Inside SQL CLR

Upvotes: 2

Related Questions