As you have noted, System.Web
is an unsupported library. In order to reference System.Web
you will need to make a call to CREATE ASSEMBLY
. It seems like you tried that, but how did you reference the location of System.Web.dll
? Did you copy/paste it to a different location? SQL Server will try to locate dependent assemblies in the same location. In other words, if you reference the location of System.Web.dll
with all of the other dependent libraries living in the same directory, it should work just fine. Here is a working example. I was able to add both the System.Web
assembly as well as your assembly:
create assembly [System.Web]
from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Web.dll'
with permission_set = unsafe;
go
create assembly SystemWebTest
from 'c:\SqlServer\SystemWebTest.dll'
with permission_set = safe;
go
You can see from the client messages all of the other assemblies that SQL Server loads. But take note, SQL Server displays the following warning for each of these:
you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.
Likewise, but adding System.Web
, take a look at the following assemblies that are added:
select
name,
permission_set_desc,
is_visible
from sys.assemblies
where is_user_defined = 1
order by is_visible desc;
name permission_set_desc is_visible
System.Web UNSAFE_ACCESS 1
SystemWebTest SAFE_ACCESS 1
Microsoft.Build.Framework UNSAFE_ACCESS 0
System.Xaml UNSAFE_ACCESS 0
System.ComponentModel.DataAnnotations UNSAFE_ACCESS 0
System.Runtime.Caching UNSAFE_ACCESS 0
System.Web.ApplicationServices UNSAFE_ACCESS 0
System.Drawing UNSAFE_ACCESS 0
Microsoft.Build.Utilities.v4.0 UNSAFE_ACCESS 0
System.DirectoryServices UNSAFE_ACCESS 0
System.DirectoryServices.Protocols UNSAFE_ACCESS 0
System.EnterpriseServices UNSAFE_ACCESS 0
System.Runtime.Remoting UNSAFE_ACCESS 0
System.Runtime.Serialization.Formatters.Soap UNSAFE_ACCESS 0
System.Design UNSAFE_ACCESS 0
System.Windows.Forms UNSAFE_ACCESS 0
Accessibility UNSAFE_ACCESS 0
System.Drawing.Design UNSAFE_ACCESS 0
System.Web.RegularExpressions UNSAFE_ACCESS 0
Microsoft.Build.Tasks.v4.0 UNSAFE_ACCESS 0
System.ServiceProcess UNSAFE_ACCESS 0
System.Configuration.Install UNSAFE_ACCESS 0
System.Runtime.Serialization UNSAFE_ACCESS 0
System.ServiceModel.Internals UNSAFE_ACCESS 0
SMDiagnostics UNSAFE_ACCESS 0
It is worth being mindful about what is actually happening here, and even though the other additional assemblies don't have ways for T-SQL entry points, they are now a dependency. I would weigh the options to see if you really need to reference System.Web
, or if there is another route to accomplish what you want.