views:

1616

answers:

2

In MS's Visual Web Developer, I have a completely default ASP.NET web service project and another project. When use the right click menu on the second project to run "Add Service Reference", I can find the first project listed as an option but I get an error when I attempt to select it, I get an error

Metadata contains a reference that cannot be resolved: 'http://0.0.0.0:3495/Service1.asmx?wsdl'.
There was an error downloading 'http://0.0.0.0:3495/Service1.asmx?wsdl'.
Unable to connect to the remote server
The requested address is not valid in its context 0.0.0.0:3495
Metadata contains a reference that cannot be resolved: 'http://localhost:3495/Service1.asmx'.
Metadata contains a reference that cannot be resolved: 'http://localhost:3495/Service1.asmx'.
If the service is defined in the current solution, try building the solution and adding the service reference again.

I have gotten the same problem when using WCF services also.

What am I doing wrong?


I found this reference that has this service and things work with that. (WhyT doesn't the default service just work?*)

A: 

The service needs to be available.

If you start just the service, add service reference should work.

Jimmie R. Houts
No joy, Ctrl-F5 seems to start the service but I still get the same error, Just F5 grays out the 'add service' option and IIRC neither work even if I open the same solution in another VS session.
BCS
hmm... could you try using IIS to debug your service and then try to add the reference.
Jimmie R. Houts
I'm trying to debug the Add reference bit so that would sort of defeat the point.
BCS
I just noticed in you error message that http://localhost is resolving to http://0.0.0.0, could you check your hosts file (located in c:\windows\system32\drivers\etc\) to make sure that there is an entry for localhost that points to 127.0.0.1
Jimmie R. Houts
+1  A: 

The reference is not getting added since the proxy is not getting generated.

In my case I got the "Metadata contains a reference that cannot be resolved" since some of the internal types used by the exposed object on the contract were not serializable.

After applying the Serializable attribute, the proxy generated correctly and a reference was added.

So you might want to check if the types exposed over the contract are serializable.

Nemo
Ah ha! Thank you :) Was just having this same problem. Forgot I'd added a new type to the contract and hadn't serialized it. +1
Mark Pim