Most of the times we get this error while consuming the hosted web service. For any exception, the what we must understand is what the exception is speaking about exactly and what is the inner exception.
The inner exception gives more details about the cause of the exception. We may have to pay attention to the details of the inner exception. For example, if the inner exception says "The remote server returned an error: (404) Not Found". If we browse the service directly, you may see the wsdl link and everything may work fine. This irritates most of the programmers.
What is the solution for this problem?
1. Get the log in the IIS server for the service. Also check the service hostname that you are accessing to and the specified one in the WSDL are same.
2. Find out the sub error code for 404 in the log. The error may not be because of the endpoint, but the infrastructure supporting endpoint. May be the resource accessed by the service is locked or not available.
3. If the services are load balanced on two or more servers, check to see if individual servers are responding by making one server passive and other one active.
4. If everything is right, then the issue might be with the load balancer.