title: WCF Service host using ServiceHostFactory with Multiple Binding
body: <p>I have created WCF service to host on IIS.
  I am using ServiceHostFactory method to host my service(using Unity as DI).</p>
  
  <p>I want to host my service using multiple binding, over the HTTP as well as over the TCP.</p>
  
  <p>I tried giving base address, but its not taking. still giving me error as Service registered with HTTP schema.</p>
  
  <p>Below code snippet might give you and idea.</p>
  
  <pre><code>public class MyServiceHostFactory : ServiceHostFactory
  {
      protected override ServiceHost CreateServiceHost(
                                  Type serviceType, Uri[] baseAddresses)
      {
          MyServiceHost serviceHost = new MyServiceHost(serviceType, baseAddresses);
  
          //configure container
          MyFactory.Register();
  
          return serviceHost;
      }
  }
  </code></pre>
  
  <p>Config file:</p>
  
  <pre><code>&lt;system.serviceModel&gt;    
  &lt;services&gt;
    &lt;service name="My.Service.MyService"&gt;
      &lt;host&gt;
        &lt;baseAddresses&gt;
          &lt;add baseAddress="http://localhost:9000/MyService/"/&gt;
          &lt;add baseAddress="net.tcp://localhost:9001/MyService/"/&gt;
        &lt;/baseAddresses&gt;
      &lt;/host&gt;
      &lt;endpoint address="Question" binding="basicHttpBinding" contract="My.Contract.IQuestionContract" /&gt;
      &lt;endpoint address="Answer" binding="basicHttpBinding" contract="My.Contract.IAnswerContract" /&gt;
      &lt;endpoint address="Question" binding="netTcpBinding" contract="My.Contract.IQuestionContract" /&gt;
      &lt;endpoint address="Answer" binding="netTcpBinding"  contract="My.Contract.IAnswerContract" /&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="MyServicebehavior"&gt;
        &lt;serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" /&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="True"&gt;
  &lt;/serviceHostingEnvironment&gt;
  </code></pre>
  
  <p></p>
  
  <p>Can anyone suggest me what can be done?</p>
  
  <p>Main thing,
  Is it possible to host service using ServiceHostFactory with Multiple Binding?</p>
  
  <p>If Yes, can anyone help me how?</p>