I am new to WCF and trying to build a demo WCF project with WebHttpBinding
binding.
The projects work fine but I am stuck with concept of fault exception. Below is the code I am using to generate fault exception but on client side what I get is (400) Bad Request error and the InnerException is null. Where am I getting wrong?
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");
}
}