title: Generate a svc / wsdl URL in my WCF web service
body: <p>Usually when i implement a 3rd party WCF web service then i get a URL that ends with an <code>.svc</code> extension.</p>
  
  <p>I just created a WCF Web Service in VS2010 and i'm able  to run that service, but i don't see any URL in the Test Client that ends with a <code>.svc</code> extension.</p>
  
  <p>Is there something else i need  to do in order to get such a URL? Because usually from there people are able to get the WSDL also by adding <code>?wsdl</code> to the end like:
   <code>http://site.com/service1.svc?wsdl</code></p>
  
  <p>How can i generate such a URL in my Web Service?</p>
  
  <hr>
  
  <p>This is what i have in my App.Config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
  
    &lt;system.web&gt;
      &lt;compilation debug="true" /&gt;
    &lt;/system.web&gt;
    &lt;!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="TestWebservice.Test"&gt;
          &lt;endpoint address="" binding="wsHttpBinding" contract="TestWebservice.ITest"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost" /&gt;
            &lt;/identity&gt;
          &lt;/endpoint&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/TestWebservice/" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <h1>Edit</h1>
  
  <p>I removed the <code>mexHttpBinding</code> endpoint from my configuration file. When i launch my Web Service now it automatically shows a URL to a WSDL:</p>
  
  <pre><code>http://localhost:8732/Design_Time_Addresses/TestWebservice/?wsdl
  </code></pre>
  
  <p>The <code>/</code> before the <code>?wsdl</code> part seems to be <strong><em>very</em></strong> important. Otherwise it won't work.</p>
  
  <p>But that still leads me to my last question. How can i specify the URL to the <code>.svc</code> file? I'd like to have a URL like: <code>http://localhost:8732/Design_Time_Addresses/TestWebservice/Test.svc?wsdl</code></p>
  
  <hr>
  
  <h1>Edit 2</h1>
  
  <p>I got a bit further. I read this: <a href="http://msdn.microsoft.com/en-us/library/aa751792.aspx">http://msdn.microsoft.com/en-us/library/aa751792.aspx</a></p>
  
  <p>So i created a <code>Test.svc</code> file in the root of my project with the following code:</p>
  
  <pre><code>&lt;% @ServiceHost Service="TestWebservice.ITest" %&gt;
  </code></pre>
  
  <p>Then i tried to access my <code>svc</code> file through the following URLs, but both didn't work for me:</p>
  
  <pre><code>http://localhost:8732/Design_Time_Addresses/TestWebservice/Test.svc
  http://localhost:8732/Design_Time_Addresses/Test.svc
  </code></pre>
  
  <p>Is it even possible to host a <code>svc</code> inside Visual Studio? Or do i really need to host it in IIS first?</p>
  
  <hr>
  
  <h1>Edit 3 - Fixed!</h1>
  
  <p>I finally have it working! I re-added the <code>mexHttpBinding</code> to my App.Config.</p>
  
  <p>I installed IIS7. Published the Web Service to a folder in my <code>C:\</code> drive. Then mapped that folder in IIS and tried to request the <code>.svc</code> file in the browser.</p>
  
  <p>At first it didn't work for me because it didn't recognize the <code>.svc</code> extension. Then all i had to do was enter the following cmd: <code>aspnet_regiis.exe -i</code> and now everything works fine.</p>
  
  <p>Everything seems to be working fine now. Guess you can't request a <code>.svc</code> file when the service is hosted by Visual Studio. But it works when its hosted in IIS.</p>