简体   繁体   中英

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM