我是WCF的新手,嘗試使用WebHttpBinding
綁定來構建演示WCF項目。在客戶端獲取Fault異常
項目工作正常,但我堅持故障例外的概念。下面是我用來生成錯誤異常的代碼,但在客戶端,我得到的是(400)錯誤請求錯誤,並且InnerException爲空。我哪裏錯了?
public DataTable GetCreativesData(string id,string type)
{
try {
DataAccess da = new DataAccess();
string qryStr = @"select * from dbo.tbMyTable";
if (type != null && type != "")
qryStr += " WHERE1 type='"+type+"'";
DataTable dt = da.GetDataTable(qryStr);
return dt;
}
catch (FaultException ex) {
throw new FaultException("Improper Query");
}
}
你是從你的WCF服務拋出'FaultException'嗎? – 2014-11-25 05:33:22
是的..我從WCF服務 – Tweety01 2014-11-25 05:42:13