![](/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.