Piercarlo
Piercarlo

Reputation: 353

Create assembly from System.Web in SQL Server

Hi I have following problem:

I need to create an assembly in SQL Server database from system.web.dll with following script:

CREATE ASSEMBLY SystemWeb 
FROM 'C:\WINDOWS\MICROSOFT.NET\FRAMEWORK\V2.0.50727\SYSTEM.WEB.DLL' 
WITH PERMISSION_SET = UNSAFE

At fist cannot create because I retrieve some error because don't find some dependencies dll.

I start to install first the dependencies like system.drawing.dll an so on without problem but when I'm trying to install system.web.dll it require System.EnterpriseServices.dll that require System.Runtime.Remoting.dll that require System.Web and here I'm inside a circle and cannot go OUT.

Somebody can help to resolve it?

Windows Server 2008 / SQL Server 2008 Enterprise

Thank you a lot in advance

Upvotes: 5

Views: 7238

Answers (2)

marc_s
marc_s

Reputation: 755167

SQL Server 2008 CLR only supports a limited list of assemblies out of the box (see this document here for details) - and system.web is not part of that list.

If you need to deploy something else, like system.web then you need to do so with the CREATE ASSEMBLY call.

Here's was a [step-by-step explanation on how to do it] - for system.web, by the way.

The key statement in that article is:

CREATE ASSEMBLY SystemWeb
from 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
with permission_set = unsafe

Since all the dependent assemblies are in the same directory, SQL Server would automatically register them.

Hope this helps!

Upvotes: 2

Filip De Vos
Filip De Vos

Reputation: 11908

These are the assemblies you need to deploy, but do you really want to do this?

system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.
system.drawing, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.directoryservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.directoryservices.protocols, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.enterpriseservices, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.
system.runtime.remoting, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.
system.runtime.serialization.formatters.soap, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.windows.forms, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089, processorarchitecture=msil.
accessibility, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.drawing.design, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.web.regularexpressions, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.serviceprocess, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.
system.configuration.install, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.

Upvotes: 1

Related Questions