VS2013 cannot add WCF service reference in solution
Asked Answered
E

2

4

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

Eby answered 3/7, 2014 at 17:5 Comment(6)
404.17 it may point to instalation error. Check this #87607 and also in what framework version is the site running onCackle
The site is on .net 3.5. And the solution you gave is for IIS. I´m still on develping time and I´m using VS2013 and the debugging is with IIS Express. There I found a link, I´ll check ay wayEby
Are you adding some reference dll from bin or debug folder? OR Windows authentication/impersonation is used anywhere?Cristencristi
NO, I just did standard procedur by the menu option, add service reference, discover, double clicking to display methods and BOOM the error I posted in the question appearsEby
Did you find a solution to this? I have an identical problemGillett
No I did not. And I changed the laptop and after new installation it doesn´t bother anymore. try removing it completely and reinstalling it again. for more info, I had the issue in an hp laptop 450, with win8. May be what people said about installing procedures of IIS and WCF support may apply, but this is IIS express, so, worth the shot yet no too much hopèEby
P
0

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

Pseudonymous answered 8/9, 2014 at 16:37 Comment(1)
But, as I told, it is not IIS related because it is happening in programming time, right when I ask Visual studio to add a service reference to a proyect, it throws this error. I dealt with it in IIS, and it is easily solved, but with IS EXPRESS, it is a nightmareEby
P
0

I have seen this problem ==> ListData.svc is the key here ==> when using an incorrect data contract attribute for a collection class.

INCORRECT:

[DataContract]
public class MyClassList : List<MyClass>
{
}

CORRECT:

[CollectionDataContract]
public class MyClassList : List<MyClass>
{
}
Parmenter answered 9/2, 2015 at 20:44 Comment(2)
What is weird is that this same error is not thrown in other PCs running the same solution. I´m beginning to think this is not a solution related issue, but possibly a HW-SW-configuration issue. Sadly I no longer had the PC with this issue so it is now impossible to test anything. But I did test running same solution on a partner computer and it was smoothEby
Sounds like this error can occur for multiple reasons. But I just wanted to add my findings for this error - since someone else may have the same issue that I had.Parmenter

© 2022 - 2024 — McMap. All rights reserved.