VS2013 cannot add WCF service reference in solution

Ricker Silva picture Ricker Silva · Jul 3, 2014 · Viewed 10.1k times · Source

I just created a WCF web site .net 3.5, I think by creting a default one would be enough to replicate. yet it is defficult to replicate. I have VS2013 with all updates as downloaded from my MSDN and I have windows 8.1.

I must say, that a few months ago I was having the issue in some machines, so the other ones heleped and I was assuming it was something related with the installation, but now it is appearing on 3 different machines, one of them with windows 8. all of them 64 bits.

The service is perfectly done, since that was until now my deliverable and on production, it is working smooth.

Now I created a basic ASP.net aqlso .net 3.5. and tried to add the service reference and it shows the following message anfter failing to add it.

There was an error downloading 'http:// localhost:40226/HabeasDataService.svc/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'http:// localhost:40226/HabeasDataService.svc'. T The remote server returned an unexpected response: (405) Method Not Allowed. The remote server returned an error: (405) Method Not Allowed. If the service is defined in the current solution, try building the solution and adding the service reference again.

Of course I did the rebuild with a clena but the problem still persists.

The configuration of the service is as follows

<system.serviceModel>
<services>
  <service behaviorConfiguration="ServicesLayer.Service1Behavior"
    name="ServicesLayer.Service1">
    <endpoint 
      bindingConfiguration="BigHttpBinding"
      name="BasicHttp"
      address="" 
      binding="basicHttpBinding" 
      contract="ServicesLayer.IHabeasDataService">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServicesLayer.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- 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 -->
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding
      name="BigHttpBinding"
      maxBufferSize="65536"
      maxBufferPoolSize="65536"
      maxReceivedMessageSize="65536"
      transferMode="Buffered">
      <readerQuotas
        maxDepth="64"
        maxStringContentLength="65536"
        maxArrayLength="65536"
        maxBytesPerRead="4096"
        maxNameTableCharCount="32768"/>
    </binding>
  </basicHttpBinding>
</bindings>
</system.serviceModel>

I noticed about this line:

<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
      <serviceMetadata httpGetEnabled="true"/>

and try both configurations and still the same mistake.

When I try running the svc file by clicking view in browser I get a 404.17 error like this.

enter image description here

It is very frustrating because it completely stalls development.

NOTE Everything related to IIS may be useful but remember it is IIS Express. Switching to local IIS anyway, still fails, but as I stated. On production server it is mint

Answer

Tony Stark picture Tony Stark · Sep 8, 2014

Based on the error, it could be that IIS is installed after WCF.

I had a similar issue and the below link helped me to resolve it

http://msdn.microsoft.com/en-gb/library/vstudio/ms752252(v=vs.90).aspx