I am trying to call a WCF service from a SQL stored procedure written in C #.
I saw different messages or questions on one topic:
Calling WCF service from SQL CLR stored procedure
Stored procedure and SQL CLR web service
But something I wonβt get. To be able to call my WCF service from a stored procedure, I create a WCF client in the C # code of the procedure:
//Create an endpoint addresss for our service
public static EndpointAddress endpoint =
new EndpointAddress(new Uri("http://localhost:32226/ServiceName.svc"));
//Create a binding method for our service
public static WSHttpBinding HttpBinding = new WSHttpBinding();
//Create an instance of the service proxy
public static ChannelFactory<IServiceName> MyChannelFactory = new ChannelFactory<IRecursosHumanos>(HttpBinding, endpoint);
// Create a channel.
public static IRecursosHumanos ServicioRrhh = MyChannelFactory.CreateChannel();
I am compiling the project as .NET 3.0+ to compile it (link to Sytem.ServiceModel). When I try to deploy it to SQL Server, I get the following message:
Msg 10301, Level 16, State 1, Line 2
Assembly 'MyAssembly' references assembly 'system.runtime.serialization, version=3.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(failed to retrieve text for this error. Reason: 15105)). Please load the referenced assembly into the current database and retry your request.
Do I have to register this assembly on the server as well? How are the builds needed for WCF? Wouldn't I damage a server adding so many assemblies?
Thank you for your help.