Search code examples
asp.netwcf

Using web service wcf and status 404 error not found


I have copied both files: clientaccesspolicy.xml and crossdomain.xml to the root folder of my web asp.net application and running in debug mode from Visual Studio. The link of the debug on VS is something: http://localhost:4801/ when I open the silverlight page where it links to a web service and I got these errors:

> Failed to load resource: the server responded with a status of 404
> (Not Found) 
>     http://localhost/clientaccesspolicy.xml
>     
>     Failed to load resource: the server responded with a status of 404 (Not Found) 
>     http://localhost/crossdomain.xml

How can I debug the web service on localhost? I have uploaded the site on server and it seems fine.


Solution

  • I had a similiar issue where I'm debugging an ASP.NET website, but my routing isn't capable of handling special ports properly, as for instance the login to the application requires redirect. Now, my next goal is to figure out a way to make the site agnostic of port, here's how I solved the port problem

    Since your application is attempting to access resources on the standard port 80 it fails, as it is listening on port 4801 for http. I had the same problem with for https (standard is 443). A solution to this is to check what programs are occupying these ports on localhost and change them to a different port or stop them while debugging. This answer has a good tool for checking this:

    https://stackoverflow.com/a/105487/943432

    I seem to remember Skype was the problem in my case. You might have issues clearing port 80 on localhost on Windows 7 due to http.sys. See this question for how to solve that:

    http://localhost/ not working on Windows 7. What's the problem?