The Web application at https://myURL 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.
! at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
at docMig.Utilities.iterateSubWebs(String sourceWebUrl)
! at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
at docMig.Utilities.iterateSubWebs(String sourceWebUrl)
- Ensure that the URL is correct
- Make sure that your account has Farm Administrator and Site Collection Administrator rights
- If your application is running outside SharePoint, please ensure to impersonate an account that has proper rights
SPUserToken userToken = web1.CurrentUser.UserToken;
SPSite s = new SPSite(sourceWebUrl, userToken);
using( SPWeb web = s.OpenWeb()){
using( SPWeb web = s.OpenWeb()){
}
4.If none of the above works; try the following steps
- Grant db_owner access to content database
- Grant db_owner access to configuration database