行为扩展导致异常

行为扩展导致异常

本文介绍了WCF-行为扩展导致异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WCF服务中,我使用自定义行为扩展(实现IErrorHandler)进行集中式异常处理/记录.

in my WCF Services, I use a custom behavior extension (implementing IErrorHandler) for centralized exception handling/logging.

到目前为止,我通过服务的配置文件中的条目添加了此处理程序-效果很好.

So far, I added this handler via entries in the config file of the service - worked great.

现在,我有一位客户,我的错误处理程序的添加导致SecurityException(作为ConfigurationErrorException的内部异常).然后,我尝试通过代码将错误处理程序添加到服务主机,并且可以正常工作!我真的很困惑-可以 有人解释吗?

Now, I have one customer where this adding of my error handler causes an SecurityException (as inner exception of a ConfigurationErrorException). I then tried adding the error handler to the service host via code, and this works! I am really confused - can anyone explain??

(更多信息:我的服务使用nettcpbinding,并且作为Windows服务而不是IIS托管).

(a few more infos: My service uses nettcpbinding, and it is hosted as Windows service, not IIS).

推荐答案

SecurityException的消息是什么?有权限吗?检查目标服务器是否没有任何特殊的CAS策略(代码访问安全性).

what is the message of the SecurityException? Is it something with permissions? Check that target server does not have any special CAS policy (code access security).

最诚挚的问候,
拉迪斯拉夫

Best regards,
Ladislav


这篇关于WCF-行为扩展导致异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 20:36