title: Two WebServiceHost instances
body: <p>I am using a library called SwaggerWcf to generate Swagger definitions for my application hosting a WCF REST API. I have finally made it work as I want it with the following code:</p>
  <pre><code>  var swaggerHost = new WebServiceHost(typeof(SwaggerWcfEndpoint));
                  var endpoint =
                      new WebHttpEndpoint(
                          ContractDescription.GetContract(typeof(ISwaggerWcfEndpoint)),
                          new EndpointAddress(&quot;http://localhost/docs&quot;))
                      {
                          AutomaticFormatSelectionEnabled = true,
                          FaultExceptionEnabled = true
                      };
  
                  // required to generate the swagger content
                  var e = new SwaggerWcfEndpoint();
  
                  swaggerHost.AddServiceEndpoint(endpoint);
  
                  var apiHost = new WebServiceHost(typeof(RestDataInterface));
                  var endpoint2 =
                      new WebHttpEndpoint(
                          ContractDescription.GetContract(typeof(IRestDataInterface)),
                          new EndpointAddress(&quot;http://localhost/api&quot;))
                      {
                          AutomaticFormatSelectionEnabled = true,
                          FaultExceptionEnabled = true
                      };
  
  
              apiHost.AddServiceEndpoint(endpoint2);
  
              swaggerHost.Open();
              apiHost.Open();
  </code></pre>
  <p>My question now is: is this the right way of doing it? As you can see I am creating two WebServiceHost instances. One for swagger and one for my actual API. While this seems to work fine, am I missing something? This API is intended to be fast but does not need to handle many concurrent users.</p>
  <p>Thank you</p>