Since the early times of SharePoint we receive support cases where a customer receives the following error message when using custom code with SharePoint:
"The Web application at http://server:port/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application"
Here are the most common reasons this error can occur: