Q:

Error The Web application could not be found.from the web service on the same server

I am developing a web service on my dev SP server and deploying on the same server http://spdevintra:100, but I am not able to access URL from SP server side object by using following simple code: 
using (SPSite siteTemp = new SPSite("http://spdevintra:300/contactus"))
                    {
                        using (SPWeb spWebTemp = siteTemp.OpenWeb())
                        {
                            SPUserToken objUserToken = spWebTemp.SiteUsers[@"i:0#.w|qr\" + objContactUs.ADUserName].UserToken;

Error message:
Message from web page
success…The Web application at http://spdevintra:300/contactus 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.

A:

I set AppPool of my web service as we have AppPool of SharePoint application. This solution solved issue as mentioned in this post

