WCF/WF - An error with web service - Asked By mostafa hamdy on 04-Oct-10 09:12 AM

hello all
I have some web service I have created in my web site and after I created it and try to use I using add service reference I get the following error:
There was an error downloading 'http://localhost/ProductsManager/ProductService/ProductService.asmx'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/ProductsManager/ProductService/ProductService.asmx
please if any body get this error so far or can help me in solving it , send me or tell me about some url may help me in solving it
regards
Mostafa
_ash_ k replied to mostafa hamdy on 04-Oct-10 09:45 AM
404 error is a page not found error. Please run the application in debug mode [F5] and it should open the page on your localhost. 
You have been trying to access the web service directly thru a URL (without the port number) ... first deploy it on the server and then make a call to it. You can pre-complie your application and then host it locally.

Check an simple example with good explanations at http://www.west-wind.com/presentations/dotnetwebservices/DotNetWebServices.asp 

Hope this helps.

_ash_
Daivagna Nanavati replied to mostafa hamdy on 04-Oct-10 01:42 PM
Hi

To add the reference of your web  service to your application, you will have to first host it, you when you host it will be accessible with localhost url, otherwise while development it opens up one port of it, so you can add the reference of that url also locally, but if the port is changed it will not work, so do the following

1) If its ASMX just host it in IIS, create virtual directory, and select the folder where you WS is, and give anonymous user rights, so that now if you can browse this web service, just copy that url and than try to add reference in your application, that will do

let me know

Thanks