title: Adding WCF service behaviors with code
body: <p>I know I can add service behaviors with some XML configuration, but I'd like to do it with a piece of C#, similar how you can add endpoint behaviors. I'm not sure how to do that, though.</p>
  
  <p>In other words, how can I add the debug behavior I've instantiated below?</p>
  
  <pre><code>var host = new ServiceHost(typeof(MyService));
  var endpoint = host.AddServiceEndpoint(typeof (MysService), 
      new WebHttpBinding(), new Uri(myURL));
  endpoint.Behaviors.Add(new WebHttpBehavior());
  var debug = new ServiceDebugBehavior
  {
      IncludeExceptionDetailInFaults = true
  };
  //WHAT DO I PUT HERE?
  host.Open();
  </code></pre>