4

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.

abatishchev
  • 98,240
  • 88
  • 296
  • 433
SirPyros
  • 350
  • 1
  • 2
  • 9
  • 1
    No - WCF is **totally independent** of ASP.NET and doesn't share settings or anything with the ASP.NET runtime by default. The `web.config` setting has no impact on WCF whatsoever – marc_s Dec 02 '11 at 21:38
  • Asked here previously...See [this post](http://stackoverflow.com/q/2916283/175679) – SliverNinja - MSFT Dec 02 '11 at 21:43
  • @SilverNinja: I read that post but it wasn't clear on the relationship between the Servicehost setting and the web.config attribute. The one person who addressed the relationship said they weren't sure. – SirPyros Dec 02 '11 at 21:47

1 Answers1

1

According to: http://msdn.microsoft.com/en-us/library/aa702682.aspx

The ASP.NET HTTP runtime handles ASP.NET requests but does not participate in the processing of requests destined for WCF services, even though these services are hosted in the same AppDomain as is the ASP.NET content. Instead, the WCF Service Model intercepts messages addressed to WCF services and routes them through the WCF transport/channel stack.

Unless you are running your services in WCF’s ASP.NET compatibility mode. In that case...

Unlike the default side-by-side configuration, where the WCF hosting infrastructure intercepts WCF messages and routes them out of the HTTP pipeline, WCF services running in ASP.NET Compatibility Mode participate fully in the ASP.NET HTTP request lifecycle. In compatibility mode, WCF services use the HTTP pipeline through an IHttpHandler implementation, similar to the way requests for ASPX pages and ASMX Web services are handled.

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.

syneptody
  • 1,250
  • 1
  • 10
  • 27