简体   繁体   English

WCF服务-HTTP500

[英]WCF service - HTTP500

I need help with wcf service. 我需要有关wcf服务的帮助。 i have a ajax-enabled wcf service: 我有启用了ajax的wcf服务:

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. 我正在使用提琴手来跟踪应用程序,我总是得到HTTP500。 The class is inherited from Page class and uses the AddMyFavorite method that takes care of database. 该类继承自Page类,并使用负责数据库的AddMyFavorite方法。 Website is hosted on iis7 网站托管在iis7上

An HTTP 500 error is something bad that happened on the server. HTTP 500错误是在服务器上发生的错误。 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. 我猜想AddMyFavorite方法会抛出某种异常,但是您必须调试一下才能确定。

Is there anything returned in 'Textview' in fiddler? 提琴手的“ Textview”中是否返回任何内容? You can see the actual error returned in firebug net panel . 您可以在firebug 网络面板中看到返回的实际错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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