我是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