我抛出未处理的DataServiceExceptions(它们由WCF自动处理)以返回未经授权访问的状态代码等。如何防止Visual Studio破坏这些未处理的异常?
if (!System.Web.Security.Roles.IsUserInRole("Users"))
{
throw new DataServiceException((int)HttpStatusCode.Unauthorized, "You do not have access to this resource.");
}
答案 0 :(得分:0)
可以添加DebuggerNonUserCode属性
或者您可以告诉visual studio忽略异常类型,如:How to tell the debugger to ignore breaking on thrown exceptions?