我试着去建立使用WCF和.NET 4的API,但是当我扔WebProtocolException,它不显示它应该像一个不错的错误信息,而不是它是治疗它像一个未处理的异常。WCF .NET 4.0的治疗WebProtocolException作为未处理的异常
我正在使用WebServiceHost2Factory。
是否有其他人使用过.net 4的WebProtocolException?
我的电话的下面是一个例子
throw new WebProtocolException(System.Net.HttpStatusCode.BadRequest, "The DateFrom parameter is invalid",
new Error()
{
Code = 6002,
Message = "Please ensure your dates are in the following format: yyyy/MM/dd hh:mm:ss"
},
null, null);