![](/img/trans.png)
[英]500 Internal Server error while accessing WCF service from http and unable to add service reference for the same reason
[英]WCF service - HTTP500
我需要有关wcf服务的帮助。 我有启用了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");
}
}
客户端看起来像这样:
function AddFavorite() {
$.ajax({
type: "GET",
url: "/WebServices/AddFavorites.svc/AddFavorite",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false
});
};
我正在使用提琴手来跟踪应用程序,我总是得到HTTP500。 该类继承自Page类,并使用负责数据库的AddMyFavorite方法。 网站托管在iis7上
HTTP 500错误是在服务器上发生的错误。 进入调试模式并调试服务-您将看到有关发生问题的更具描述性的消息。 我猜想AddMyFavorite方法会抛出某种异常,但是您必须调试一下才能确定。
提琴手的“ Textview”中是否返回任何内容? 您可以在firebug 网络面板中看到返回的实际错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.