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.

  • Does the URL for that site already exist?
    – Graham
    Sep 29, 2017 at 14:46
  • @Graham Yes URL spdevintra:300/contactus is working fine in browser. do I need to deploy web service on the same SP web application,
    – SPDev
    Sep 29, 2017 at 22:12

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.