Writing a WCF Sharepoint handler I had a great deal of trouble wondering why SPSite host = new SPSite(http://localhost..../) was giving a Web application could not be found error. The URL opened fine in a browser.
The answer appears to be security related where the WCF service doesnt seem to have enough permission to get to the local sharepoint server. One workaround which seems to work is to set the WCF Application Pool permissions to the same as the Sharepoint Application Pools. Im not sure its elegant but until I find a better way this seems to work. Thanks to the following blog: Chaks' Corner WCF and Sharepoint - System.IO.FileNotFound Exception