views:

59

answers:

2

I am working on a .NET project which uses Microsoft SQL server. In this project, I need a CLR stored procedure (written in C#) that uses a remote web service. So, when the stored procedure is executed on the SQL server, it makes web service calls and thus sends packets to a remote location. The problem is that when executing the SP I get: "System.Net.WebException: The request failed with HTTP status 403: Forbidden."

The database user has full permission, the deployed CLR assembly and SP are even marked "unsafe", I tried signing it etc., so any of that is not causing the problem.

When I am executing the very same C# code, but from a simple console application instead of as a SP, it all works fine. So I started to suspect a network related problem and had a packet sniffer running when executing both the SP and the console app version.

What I realized was that the packets sent out had different destination IP addresses: the console app sent the packets directly to the web service IP while the SP sent the packets to a proxy server we use in our company. Due to network policies the latter is not allowed and that explains the "403 Forbidden" exception.

So my question boils down to this: How can I configure the SP/MS SQL server to NOT use that proxy? I want it to send the packets directly to the web service IP, just like the test console app. (again, the C# code is the same , so it's not a programming matter).

I've disabled all proxy settings in Internet Explorer in case the SQL server inherits these settings or something. However, no luck.

Any help would be greatly appreciated!

Best regards, Peter

A: 

The most likely explanation is some kind of network level transparent proxy. I would discuss the issue with whoever manages/administers your network.

Ben Robinson
+1  A: 

Don't make HTTP web calls from SQL CLR.

Make all Web service calls from an outside process. Unless you want to find your production server frozen in worker starvation with all threads blocked in CLR events. You have been warned.

Remus Rusanu