0
我在這裏遇到了一個我無法解決的問題。 我正在做一個職位與Ajax和JSON傳遞數據通過WCF,但不工作......給我壞請求。 我不知道我做錯了什麼......WCF方法發佈json返回錯誤請求
我的代碼是這樣的
Service1.svc.cs:
namespace Teste
{
public class Service1 : IService1
{
public string GetData()
{
string getdata = "hello";
return string.Format("You entered" + getdata);
}
public string GetDataName(string Name)
{
return string.Format("You entered" + Name);
}
}
}
IService1.cs:
namespace Teste
{
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "GetData", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
string GetData();
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "GetDataName", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
string GetDataName(string Name);
}
}
任何人都可以告訴我爲什麼當我用這個名字發帖時,它給了我不好的要求?
問候