title: WCF service exposing 2 endpoints on 2 different service contracts
body: <p>I have an WCF service which I am trying to configure so that it exposes 2 endpoints, refering to different functionalities, under different URLs.</p>
  
  <p>What I want to have is <strong>Service1</strong>, exposing methods A, B, C, and <strong>Service2</strong>, exposing methods D, E.
  I want to be able to browse both <strong>localhost/WebServiceName/Service1/Service.svc</strong> and <strong>localhost/WebServiceName/Service2/Service.svc</strong>.</p>
  
  <p>Other applications referencing <strong>localhost/WebServiceName/Service1/Service.svc</strong> should see only the interface containing the methods A, B and C. They should not see anything regarding <strong>Service2</strong> interface. And for <strong>Service2</strong> likewise.</p>
  
  <p>So far I have defined two interfaces in my WCF service, <strong>I_Service1</strong> and <strong>I_Service2</strong>.</p>
  
  <p>I have added two endpoints in my web.config like so:</p>
  
  <pre><code>&lt;endpoint address="http://localhost/WebServiceName/Service1/" binding="wsHttpBinding" contract="WebServiceName.I_Service1" bindingConfiguration="Binding1" /&gt;
  &lt;endpoint address="http://localhost/WebServiceName/Service2/" binding="wsHttpBinding" contract="WebServiceName.I_Service2" bindingConfiguration="Binding2" /&gt;  
  </code></pre>
  
  <p>The suggestion of using full address in the enpoint comes from here: <a href="https://stackoverflow.com/questions/1182725/multiple-endpoints-under-iis?rq=1">Multiple endpoints under IIS</a></p>
  
  <p>But still, I can't browse <strong>localhost/WebServiceName/Service1/Service.svc</strong>. I receive:</p>
  
  <pre><code>Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
  </code></pre>
  
  <p>I can successfully browse <em>localhost/WebServiceName/Service.svc</em> and the wsdl includes methods A, B, C, D, E. But this should be wrong in the behaviour I want.</p>
  
  <p>Is there something that I have missed?</p>
  
  <p>UPDATE: Following this article <a href="http://allen-conway-dotnet.blogspot.ro/2011/09/exposing-multiple-binding-types-for.html" rel="nofollow noreferrer">http://allen-conway-dotnet.blogspot.ro/2011/09/exposing-multiple-binding-types-for.html</a> I created two different contract services for those endpoints. But currently I am seing only <strong>Service1</strong> when I browse it. <strong>Service2</strong> apparently does not exist (HTTP 404 error related issues appear).</p>
  
  <p>The configuration looks like:</p>
  
  <pre><code>&lt;services&gt;
     &lt;service behaviorConfiguration="WebServiceName.ServiceBehavior1" name="WebServiceName.Service1"&gt;
      &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1"
       contract="WebServiceName.I_Service1" /&gt;
      &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
       &lt;host&gt;
         &lt;baseAddresses&gt;
           &lt;add baseAddress="http://localhost/WebServiceName/Service1/Service.svc" /&gt;
         &lt;/baseAddresses&gt;
       &lt;/host&gt;
     &lt;/service&gt;
     &lt;service behaviorConfiguration="WebServiceName.ServiceBehavior2" name="WebServiceName.Service2"&gt;
      &lt;endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1"
       contract="WebServiceName.I_Service2" /&gt;
      &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
       &lt;host&gt;
         &lt;baseAddresses&gt;
           &lt;add baseAddress="http://localhost/WebServiceName/Service2/Service.svc" /&gt;
         &lt;/baseAddresses&gt;
       &lt;/host&gt;
     &lt;/service&gt;
    &lt;/services&gt;
  </code></pre>