WCF Service runs perfectly when running under iis express but same service wont work when running under Local IIS with its virtual directory
<p>I was practising WCF and stuck to this situation.
My Wcf service works perfectly under IISExpress (default for VS2013).
But When I use the same under Local IIS, I got below exception in WCF Test Client.</p>

<blockquote>
  <p>Error: Cannot obtain Metadata from
  <a href="http://localhost/WcfService1/Service1.svc" rel="nofollow noreferrer">http://localhost/WcfService1/Service1.svc</a> If this is a Windows (R)
  Communication Foundation service to which you have access, please
  check that you have enabled metadata publishing at the specified
  address. For help enabling metadata publishing, please refer to the
  MSDN documentation at
  <a href="http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata</a> Exchange
  Error URI: <a href="http://localhost/WcfService1/Service1.svc" rel="nofollow noreferrer">http://localhost/WcfService1/Service1.svc</a> Metadata contains
  a reference that cannot be resolved:
  '<a href="http://localhost/WcfService1/Service1.svc" rel="nofollow noreferrer">http://localhost/WcfService1/Service1.svc</a>'. The remote server
  returned an unexpected response: (405) Method Not Allowed. The remote
  server returned an error: (405) Method Not Allowed.HTTP GET Error URI:
  <a href="http://localhost/WcfService1/Service1.svc" rel="nofollow noreferrer">http://localhost/WcfService1/Service1.svc</a> There was an error
  downloading '<a href="http://localhost/WcfService1/Service1.svc" rel="nofollow noreferrer">http://localhost/WcfService1/Service1.svc</a>'. The request
  failed with HTTP status 404: Not Found.</p>
</blockquote>

<p>My web config has endpoint for metadata exchange and also behaviour has httpGetEnabled true.</p>

<p>See web.config:</p>

<pre><code>&lt;?xml version="1.0"?&gt;
&lt;configuration&gt;

  &lt;system.diagnostics&gt;
    &lt;sources&gt;
      &lt;source name="System.ServiceModel.MessageLogging" switchValue="Warning,ActivityTracing"&gt;
        &lt;listeners&gt;
          &lt;add type="System.Diagnostics.DefaultTraceListener" name="Default"&gt;
            &lt;filter type="" /&gt;
          &lt;/add&gt;
          &lt;add name="ServiceModelMessageLoggingListener"&gt;
            &lt;filter type="" /&gt;
          &lt;/add&gt;
        &lt;/listeners&gt;
      &lt;/source&gt;
    &lt;/sources&gt;
    &lt;sharedListeners&gt;
      &lt;add initializeData="f:\tfs\wcfservice1\wcfservice1\web_messages.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp"&gt;
        &lt;filter type="" /&gt;
      &lt;/add&gt;
    &lt;/sharedListeners&gt;
    &lt;trace autoflush="true" /&gt;
  &lt;/system.diagnostics&gt;
  &lt;appSettings&gt;
    &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt;
  &lt;/appSettings&gt;
  &lt;system.web&gt;
    &lt;compilation debug="true" targetFramework="4.5" /&gt;
    &lt;httpRuntime targetFramework="4.5"/&gt;
  &lt;/system.web&gt;
  &lt;system.serviceModel&gt;
    &lt;diagnostics&gt;
      &lt;messageLogging logEntireMessage="true" logMalformedMessages="true"
        logMessagesAtTransportLevel="true" /&gt;
    &lt;/diagnostics&gt;
    &lt;services&gt;
      &lt;service behaviorConfiguration="behave" name="WcfService1.Service1"&gt;
        &lt;endpoint address="WcfService1.Service1" binding="basicHttpBinding" name="basicHttp"
          contract="WcfService1.IService1" /&gt;
        &lt;endpoint binding="mexHttpBinding" name="mex" contract="IMetadataExchange" /&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="http://localhost/WcfService1/" /&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
      &lt;/service&gt;
    &lt;/services&gt;
    &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name="behave"&gt;
          &lt;serviceMetadata httpGetEnabled="true" policyVersion="Policy15" /&gt;
          &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;
    &lt;protocolMapping&gt;
        &lt;add binding="basicHttpsBinding" scheme="https" /&gt;
    &lt;/protocolMapping&gt;    
    &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
  &lt;/system.serviceModel&gt;
  &lt;system.webServer&gt;
    &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      --&gt;
    &lt;directoryBrowse enabled="true"/&gt;
  &lt;/system.webServer&gt;

&lt;/configuration&gt;
</code></pre>

<p>I checked other WCF questions. but couldn't find answer. 
Thanks in advance.</p>

<p>When I use Local IIS, I am able to hit url 
<a href="http://localhost/wcfservice1/" rel="nofollow noreferrer">http://localhost/wcfservice1/</a>
and it shows me all files at that directory.
but when I click on Service1.svc, it shows IIS error page.</p>

<blockquote>
  <p>HTTP Error 404.3 - Not Found The page you are requesting cannot be
  served because of the extension configuration. If the page is a
  script, add a handler. If the file should be downloaded, add a MIME
  map.</p>
</blockquote>

<p>After addng WCF activation in IIS. Now I am getting different Error.
I couldn't understand it.
<a href="https://i.stack.imgur.com/mDjI6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mDjI6.png" alt="enter image description here"></a></p>