私は WCF を初めて使用し、WebHttpBinding
バインディングを使用してデモ WCF プロジェクトを構築しようとしています。
プロジェクトは正常に動作しますが、障害例外の概念に固執しています。以下は、エラー例外を生成するために使用しているコードですが、クライアント側では(400) Bad Requestエラーが発生し、InnerException は null です。どこが間違っていますか?
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");
}
}