2

I have an ASP.NET WEB API code running on .NET 4.5 with MVC 4.0 RC and EF 5.0 Pre-release. This is running on IIS 7.5, Win server 2008 R2 Datacenter.

The phenomena is this:

when calling POST locally to localhost (on IIS), all is ok and I get redirected to the created object as the response page (it's set in the response header) with status 201.

But when calling from external URL, I get no response. The code runs well and there is no exception, but in chrome developer tools for example, I see no response coming back. it says the request was cancelled.

No matter what I tried, can't solve this. THE EXACT SAME CODE on the same IIS folder runs from local calls fine, but for remote calls - returns nothing. This happens for 2 different controllers.

However, other calls (Get for example) work well for both local and remote calls.

This is the Controller code in the POST method which builds the response:

HttpResponseMessage response = this.Request.CreateResponse<Movie>(HttpStatusCode.Created, Movie);
string uri = Url.Route(null, new { id = Movie.Id });
response.Headers.Location = new Uri(Request.RequestUri, uri);
return response;

Your help muchly appreciated!

Thanks!

Nadav Lebovitch
  • 690
  • 6
  • 8
  • In such a scenario, this is really hard to pinpoint the problem with the information you have given. Try to get as much error details as possible out of your application. If the error is at the IIS level, enable failed request tracing and see the produced trace log. – tugberk Jul 22 '12 at 13:29
  • Hi, I turned it on and eventually is says response is returned with status code 200. Which is REALLY wierd. I knew the request doesn't fail in the code, because I know that the object is created and the code runs fine. Does it make any sense that the IIS will report 200 but the browser will get no response? (Again, only in a case where the call is to the external IP address. in Localhost it works fine) – Nadav Lebovitch Jul 22 '12 at 14:41
  • try sending a request with fiddler, do u get 500 again? – tugberk Jul 22 '12 at 15:10
  • So, it seems that when performing an external request, all 3 browsers (Chrome, FF, IE8) behave differently with the same JQUERY page which sends the request: Chrome shows it failed, FF shows it's ok (201 - created) but doesn't show the response data and IE writes some "no transport" error. on IE - Fiddler doesn't even show a request initiated. on both others it does. So this is turning into a pure IIS question: how come different browsers behave totally differently with same simple request / response data? – Nadav Lebovitch Jul 23 '12 at 07:41
  • Did you find this solution.? Actually me to trapped with this .. – Jeeva J Jan 14 '15 at 17:58

0 Answers0