tags:

views:

20

answers:

0

I have a WCF service that exposes some methods with WebInvoke and POST method, this has been working on a Windows 2003 server machine for some time now, the thing is that I have to migrate the service to a new windows 2008 server machine and this is where I'm getting the issue, I get error 400 Bad Request when I try to call from the client. The code deployed into both machines is the same, I have been trying to perform the calls with both a UnitTest VS2008 solution and Fiddler2, the very same request returns a 200 OK response from the w2003 server but the 400 on the 2008 one.

I had another WCF service based on the same philosophy also working on the 2003 server machine so I tried to deploy it on the 2008 server, I found out that GET methods worked correctly on both machines but If I try to consume a very simple POST method, then I get an ERROR 500. Internal Server Error pointing o an "Object reference not set to an instance of an object" error. The thing is that also this method is working If I make the call to the other server, the call is exactly the same, only changes the IP, so I think that there must be some problem with IIS 7 that I can't figure out since the code is working perfectly on w2003/IIS6. I checked for .NET 3.5 installed and all the stuff I found on the forums.

I guess I should post some code but since it's working on the W2003 machine I'm not quite sure It would make any difference, I tried all sort of things with bindings but no luck, I think It should not be necessary since I'm not trying to generate any proxy with svctool or VS2008, I just format an URL request and send it to the server, as stated before it's working flawlessly on the first machine...

Here is an example of a request hand-made with fiddler2 (on the unit tests I use the WebRequest class to generate the request object with the same result):

POST http://XX.XXX.XXX.XXX/ServiceiPhone/service.svc/DoWork HTTP/1.1 Host: XX.XXX.XXX.XXX User-Agent: FoodLinker/1.0 Accept: text/xml Content-Type: application/json Accept-Language: es-es Accept-Encoding: gzip, deflate Content-Length: 17 Connection: keep-alive

{"Data":"MyData"}

The code on the server looks like this:

[WebHelp(Comment = "Sample description for DoWork")]
[WebInvoke(UriTemplate = "DoWork")]
[OperationContract]
public SampleResponseBody DoWork(SampleRequestBody request)
{
    //TODO: Change the sample implementation here
    return new SampleResponseBody()
    {
        Value = String.Format("Sample DoWork response: '{0}'", request.Data)
    };
}

There is no special binding configuration on the web.config file, as stated before it's working on the previous machine but no on the other one.

This is for the test project, the code I really want to deploy is a little bit more complex but its a similar scenario and I think If I can manage to solve this probably I will with the other one.

Any ideas would be very welcome, thanks in advance