开发者

500 error from a RESTful web service which doesn't even act on the http request

I have a set of ASP.Net pages running on IIS7. Being RESTful, we expect to receive some XML. This is not going to be a public service so the XML format is agreed upon. We need this service as an integration between two sites and the the service pushes data in one direction.

I tested how it works by using the Poster add-on for Firefox and everything went fine. However, the expected caller would be another website (making a server side call every few hours or upon user action) and I get the expected response.

However, when we try and call it from the other site (from where it needs to work) it throws an 500 error.

I weren't sure which part of the code was creating a problem so we commented out the whole of Page_Load() and still the same!

I tried with cURL, through some other code but only the calls from the server is throwing a 500. The I开发者_如何学JAVAIS logs confirm the right URL is being called. I even tried making calls using the same User Agent, but my web service doesn't like that server alone.

Am really scratching my head on this one - how can no code at all throw a 500? Could it be because of some HTTP headers or maybe the server is sending a SOAPAction header?

(I cannot confirm this right now because am out of office ATM)


Alright, I was sending the XML POST directly and the server was sending it as a param - xmlObject= and validateRequest was true.

Thanks Carson63000 for the comment!


I had the same issue, which turned out to be a simple mistake in the web method parameters. My Web Method was doSomething(int parameter) but I was calling it with doSomething?parameter=1.0 i.e a double.

Seems IIS/ASP throws this HTTP 500 exception when it cant translate the parameter into the type that the web method is expecting.


In my opinion, the two most common sources of 500 response codes, in ASPNET, are:

  • Web.config is corrupted or broken
  • global.asax is throwing an exception

See also, this blog entry on troubleshooting 500 errors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜