0
votes

the problem : when adding service reference -> chosing the address http://localhost:8000 -> pressing GO

There was an error downloading 'http://localhost:8000'.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:8000
Metadata contains a reference that cannot be resolved: 'http://localhost:8000/'.
There was no endpoint listening at http://localhost:8000/ that could accept the message.
This is often caused by an incorrect address or SOAP action.
See InnerException, if present, for more details.
Unable to connect to the remote server
No connection could be made because the target machine actively refused it 127.0.0.1:8000
If the service is defined in the current solution, try building the solution and adding the service reference again.

The service contract :

[ServiceContract(Namespace="http://www.thatindigogirl/2011/12")]
public interface IHelloIndigo
{
    [OperationContract]
    void DoWork();
}    

The service :

public class HelloIndigo : IHelloIndigo
{
    public void DoWork()
    {
        throw new NotImplementedException();
    }
}

The host's app.config :

 <system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="serviceBehavior">
                <serviceMetadata httpGetEnabled="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="serviceBehavior" name="HelloIndigo">
          <host>
            <baseAddresses>
              <add baseAddress="http://localhost:8000" />
            </baseAddresses>
          </host>
          <endpoint address="HelloIndigoService" binding="basicHttpBinding"
                 name="basicHttp" contract="Host.IHelloIndigo" />
            <endpoint binding="mexHttpBinding"  name="mex"
                contract="IMetadataExchange" />                
        </service>
    </services>
</system.serviceModel>
  • This solution was rebuilt from an vs2008 to vs2010 I changed the framework to 4.0 in both projects client and host .
  • The configurations were made by the wcf configuration wizard.

Any idea why the client project can't locate the host end point to retrieve the metadata ?

Thanks in advance.

4
If you open that address in a browser, do you get the service page?Tad Donaghe
Your service is definitely not running, based on the exception you're seeing.Yuck
yes, i run the host and go to localhost:8000 and the service is there.eran otzap
both projects are in the same soultion if i run the host project i can't choose the Add service reference option on the client project maybe i can't locate a service in this way if they are in same soulotion , i wasn't able to locate the service with the Discover option of the Service reference wizard.eran otzap
what is the HelloIndigoService in the first endpoint?gmail user

4 Answers

0
votes

This is probably that the service is not running.

It could also be that port 8000 is blocked.

Edit:

Based on your comment that the discover does not work within the same solution: This means that something is wrong with the project type.

Thry to create a new WCF project, add the services you need, then copy over your existing code.

0
votes

I had the same issue while revising an existing web odata service and then attempting to establish a new service reference to the revised service in a Silverlight project. By temporarily commenting out the authentication and authorization sections in the web.config file I was able to connect to and download the metadata from the data service to my Silverlight project. Rick Moulton

-3
votes

I was trying to do the same thing you were, adding a service reference only to run into a connection error because the current service wasn't running.

In order to pull this trick off, you need to open two Visual Studio Instances and use one to first Open the "Add Service Reference" Menu. With the menu open, in your other Visual Studio, debug your application so that your service is running.

While the service is running enter the address in the "Add Service Reference" menu and it WILL find your URL listening service. Only then can you select the interface or class you wish to reference.

After that's done you can stop the debugging and the changes will take effect. You may get a warning that your project was modified outside the editor just click OK and you'll be good.