网上找了一个aop,准备改下自己用 //执行方法前
if (this._interceptorObject.MethodExecuting(this._interceptorObject, call.MethodBase.Name, call.Args))
{
try
{
//执行方法
retMsg = _nextSink.SyncProcessMessage(msg);
}
catch(Exception ex)
{
调试测试,方法报错没有进入到这里
}
//接受返回结果
var returnValue = ((IMethodReturnMessage)retMsg).ReturnValue;
//执行方法后
this._interceptorObject.MethodExecuted(this._interceptorObject, call.MethodBase.Name, call.Args, returnValue);
}
if (this._interceptorObject.MethodExecuting(this._interceptorObject, call.MethodBase.Name, call.Args))
{
try
{
//执行方法
retMsg = _nextSink.SyncProcessMessage(msg);
}
catch(Exception ex)
{
调试测试,方法报错没有进入到这里
}
//接受返回结果
var returnValue = ((IMethodReturnMessage)retMsg).ReturnValue;
//执行方法后
this._interceptorObject.MethodExecuted(this._interceptorObject, call.MethodBase.Name, call.Args, returnValue);
}
解决方案 »
- 求助<asp:AutoCompleteExtender>控件,是否可以实现如下效果.
- NET C# 怎么清除Cookie???
- GridView的导出excel问题,请高手帮忙
- .net 中的.edmx数据模型能不能连接access啊,怎么连?
- Server.Transfer在Updatepanel下失效的问题
- 您把哪些东东看成了对象?
- 在vs2008中没有错误,在IIS7中出现编译错误
- 用过vs2008的请教下.
- [求助]http/1.0 503 service unavailable的问题
- 求助,请问一下asp:Label怎么做按键滚动,在线急求
- 错误!如题 web.config!!!!!!!!!!!!
- 请问以前用的asp.net做网站,现在是不是要学习asp.net core做网站啦?
发现有bug就换一个啊
如果想简单就用那些流行的重量级AOP框架
要轻量的就可以慢慢试
retMsg = _nextSink.SyncProcessMessage(msg);方法栈异常仅限于SecurityException,可能是CLR在执行方法调用前,权限检查不符条件而抛出,而不会是方法本身抛出的。
IMessage retMsg = new ReturnMessage(new Exception("Hey!"), call);
你还需要自己下载吗?
蛋疼
如果不是要用到第三方的扩展方法,
那我觉得就够用了。
https://blog.csdn.net/hanjun0612/article/details/50913485
services.AddMvc(option =>
{
option.Filters.Add(new GlobalExceptionFilter()); //錯誤捕捉
});
不是网上有问题,你让我代理了,那么你觉着出错了,是你知道,还是我知道。当然是我知道,我是代理人,是我办的事情ps:别惊讶,但凡这类都这样,比如微软自己的路由,有多少在联调的时候说,“这不是我的问题,你都没进我的方法”,why?路由,参数检查是微软代理的,他说错了,直接就扔500或者404了,哪还轮到你的代码