0
我有一個名爲「WebMethods」的WCF服務。以下是我的代碼。WCF Web服務不工作
在IWebMethods.cs:
[ServiceContract(Name = "WebMethods")]
public interface IWebMethods
{
[OperationContract]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped, Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
String Test();
}
在WebMethods.cs:
public class WebMethods : IWebMethods
{
public String Test()
{
return "This is a test YEAH!!";
}
}
和調用的javascript:
$.ajax({
url: 'WebMethods.svc/Test',
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: null,
async: false,
success: function (data) {
alert(data);
},
error: function (xhr, textStatus, errorThrown) {
alert(errorThrown);
}
});
當我執行我的javascript我得到的錯誤「內部服務器錯誤」。有人可以告訴我我做錯了什麼,或者至少我能做些什麼來解決這個問題?
您能提供比'內部服務器錯誤'更多的日誌嗎? – fmgp 2012-04-20 17:35:45
@fmgp,這是服務返回的唯一錯誤。有什麼地方可以查找更詳細的錯誤消息嗎? – Coltech 2012-04-20 17:37:39
您可以直接導航到您的服務頁面嗎? – 2012-04-20 17:49:37