我在默认服务行为中添加了一个服务行为扩展,用于记录未处理的异常,它按预期工作。
<extensions>
<behaviorExtensions>
<add name="UnhandledExceptions"
type="MyApp.WebServices.Behaviours.Extensions.UnhandledExceptionExtention, MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior>
<UnhandledExceptions />
</behavior>
</serviceBehaviors>
</behaviors>
但是,当我尝试将新服务添加到项目中时,出现以下错误:
更新配置文件失败
无法加载为扩展“UnhandledExceptions”注册的类型“MyApp.WebServices.Behaviours.Extensions.UnhandledExceptionExtention, MyApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”。Web.config 第 XX 行
为了解决这个问题;我注释掉服务行为中的扩展用法,添加服务并撤消配置更改。
尽管这是一个可行的解决方案,但我宁愿不必依赖我自己和其他开发人员记住看似不必要的过程。
有没有办法解决这个问题?