WCF service - HTTP500
I need help with wcf service. i have a ajax-enabled wcf service:
public class AddFavorites : Page
{
// Add [WebGet] attribute to use HTTP GET
[WebGet(RequestFormat = WebMessageFormat.Json)]
[OperationContract]
public void AddFavorite()
{
this.AddMyFavorite(10, "sometext", "sometext");
}
}
And clientside looks like this:
function AddFavorite() {
$.ajax({
type: "GET",
url: "/WebServices/AddFavorites.svc/AddFavorite",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false
});
};
Im using fiddler to trace the application and i always get HTTP500. The class is inherited from Page class and uses the AddMyFavorite method that takes care of database. Website is hosted on开发者_开发百科 iis7
An HTTP 500 error is something bad that happened on the server. Go in debug mode and debug your service - you'll see a more descriptive message about what went wrong. I would guess that the AddMyFavorite method throws and exception of some kind, but you have to debug this to see for sure.
Is there anything returned in 'Textview' in fiddler? You can see the actual error returned in firebug net panel.
精彩评论