WCF @ServiceHost 调试=“true”但 web.config 编译=“假”
我一直在查看 MSDN 文档,但没有找到具体的答案。
@ServiceHost 中的 Debug 属性是否会覆盖 Web.config 的编译属性,还是 web.config 属性会覆盖所有属性?
谢谢。
I have been looking in the MSDN docs but have not found a concrete answer.
Does the Debug property in @ServiceHost override the Web.config's compilation attribute or does the the web.config attribute override all?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据: http://msdn.microsoft.com/en-us/library/ aa702682.aspx
除非您在 WCF 的 ASP.NET 兼容模式下运行服务。在这种情况下...
如果我们接受这个断言,那么我们就知道应该尊重配置继承。
如果您想确保可以设置一个测试...
在 ASP.NET 兼容模式下运行的 WCF 服务可以访问 HttpContext.Current 及其关联状态。这意味着您可以询问 IsDebuggingEnabled 属性来查看是否处于调试模式。您还可以使用一些编译器指令(例如#if DEBUG)来查看是否到达代码块。
我很好奇最终的判决是什么。我认为这个问题的关键在于这是否是一个托管在IIS中的WCF服务以及它是否以AspCompatibility模式运行。
According to: http://msdn.microsoft.com/en-us/library/aa702682.aspx
Unless you are running your services in WCF’s ASP.NET compatibility mode. In that case...
If we accept this assertion than we know that configuration inheritance should be respected.
If you wanted to be sure you could probably set up a test...
WCF services running in ASP.NET Compatibility Mode can access HttpContext.Current and its associated state. That means that you could interrogate the IsDebuggingEnabled property to see if you are in debug mode. You could also use some compiler directives like #if DEBUG to see if a block of code is reached.
I'd be very curious to hear what the ultimate verdict is. I think the key to this questions is whether or not this is a WCF service that is hosted in IIS and whether or not it is running in AspCompatibility mode.