9

Is there a performance penalty of setting Debug="true" in the svc file? Is it significant enough to warrant setting it to "false" in a production environment?

%@ ServiceHost Language="C#" **Debug="true"** Service="AwesomeService" %>

Thanks

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Pking
  • 953
  • 1
  • 14
  • 33

3 Answers3

5

In your ".svc" file, if you are writing your service as inline code, or implementing service in "App_Code" folder and enabling debug mode, it will impact the performance.

Generally, always set debug="false" before you deploy to production. If debug mode is enabled, the performance of your application can be decreased.

In Release mode, the debug symbols are not baked into the assembly, so you cannot debug it using Visual Studio .NET or other source code debuggers. What's cool is that the code is also optimized during this build operation.

Min Min
  • 6,188
  • 2
  • 19
  • 17
3

Seems that this switch controls debug symbols generation only for inline code.

Debug symbols for code-behind generation controlled by other options.

If you have no inline code, you don't hit the performance.


Meanwhile MSDN states the following:

Debug

Indicates whether the Windows Communication Foundation (WCF) service should be compiled with debug symbols. true if the WCF service should be compiled with debug symbols; otherwise, false.

Community
  • 1
  • 1
abatishchev
  • 98,240
  • 88
  • 296
  • 433
2

The short answer is yes but if you want all the gory details, look at this good StackOverflow answer on the topic.

Sixto Saez
  • 12,610
  • 5
  • 43
  • 51
  • This blog entry is pretty old and somewhere out-of-date. – abatishchev Apr 10 '12 at 12:48
  • Old does not imply incorrect, the effect of debug = true is still applicable in IIS 7.5 and there are internal compiler optimization that are turned off when an assembly is complied with debug = true regardless of which version of ASP.NET you use. If you have any specifics on inaccuracies please explain. – Sixto Saez Apr 10 '12 at 12:54