Web service request fails with HTTP status 400: Bad Request

I am having troubles with the 400: Bad Request error with my web services, called from ASP.NET 2.0. Here is the setup:

App Server A: IIS 6, Windows Server 2003, ASP.NET 2.0 (local dev box)
App Server B: IIS 6, Windows Server 2003, ASP.NET 2.0 (test server)
App Server C: IIS 6, Windows Server 2003, ASP.NET 2.0 (production server)
DB Server D: SQL Server 2005 running native web services (Windows Server 2003)

Servers A, B and D are on the same subnet. Server C is on a different subnet.

Scenario:

Servers A and B work fine! I can call the web services exposed on Server D without any problems.

Server C is the troubled server. The first web service call succeeds just fine, but the second call fails. If I continue to make calls, I see this pattern: Success.... Fail (400)... Success... Fail(400)... Success... etc.

On the WebException that accompanies the 400 error, the Status is "ProtocolError." The response has a content length of 35, but I can't ever open the response stream because, for some reason, it gets disposed as soon as it hits the catch block. Weird.

Anyway, I suspect that the "Bad Request" problem has something to do with the network, perhaps the fact that this flaky server is on a different subnet than the server that hosts the web services. Does anyone have an idea about what might cause this problem, or how to fix it (besides changing the subnet)

Thanks!



Answer this question

Web service request fails with HTTP status 400: Bad Request

  • Bharath Nadig

    Hi I think it has something to do with Authetication.i.e.if ur web proxy is using NTLM Authentication. I am not sure of authentication approach but i think it works as: As in the first web request it handshakes with proxy with the credentials provided by you and then procy just returns the response of bad request to client and issued it a token. In the next web request that issued token is passed back to proxy and it uses it for authentication.This is how it works...

  • tubefeed

    pmccombs wrote:
    I am having troubles with the 400: Bad Request error with my web services, called from ASP.NET 2.0.
    ...

    Server C is the troubled server. The first web service call succeeds just fine, but the second call fails. If I continue to make calls, I see this pattern: Success.... Fail (400)... Success... Fail(400)... Success... etc.

    Are your requests that Fail happening always in that order I'm experiencing something very similar, but think it may be load balancer related. However, if I submit rapid fire, they all succeed. If I wait longer than approx. 3 seconds after a successful call, it will fail. Then, after a failure - no matter when the next call occurs, it always succeeds.

    Strange, indeed. I know the web service I'm ultimately trying to communicate with uses cookies with the .NET web app that it also serves, so I'm trying to mess with cookies to see if that helps.

    Have you had any luck solving your problem


  • jamaddox

    Thanks for the reply. I'm fairly certain that there is no proxy involved here. The networks are both internal and are simply different subnets with appropriate gateways to route between them.

    If the issue were one of authentication, I would expect the web service calls to always fail. Instead, every other call succeeds.

  • Mark Ramey

    u can find more about Authentication

    http://www.thescripts.com/forum/thread375713.html



  • Web service request fails with HTTP status 400: Bad Request