How to configure outgoing connections from an SQL stored procedure?

Posted by Peter Vestberg on Stack Overflow See other posts from Stack Overflow or by Peter Vestberg
Published on 2010-05-16T13:40:59Z Indexed on 2010/05/16 14:00 UTC
Read the original article Hit count: 373

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

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server