tags:

views:

24

answers:

2

Hi guys,

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

A: 

Is there anything returned in 'Textview' in fiddler? You can see the actual error returned in firebug net panel.

Giorgi
Textview in fiddler is empty, firebug returns '500 Internal Server Error'
ilkin
+1  A: 

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.

Slavo