11

Follwing is my code which uses RunWithElevatedPrivileges in a visual web part

SPServiceContext serverContext = SPServiceContext.GetContext(currentSite);
UserProfileManager profileManager = new UserProfileManager(serverContext);
UserProfile profile = profileManager.GetUserProfile(currentAccountName);

using (SPSite site = new SPSite(profile.PersonalUrl.AbsoluteUri))
{
   foreach (SPWeb web in site.AllWebs)
   {
       .....
   }
}

It throws an exception when it comes to site.Allwebs and says: There is a compatibility range mismatch between the Web server and database "WSS_Content", and connections to the data have been blocked to due to this incompatibility. This can happen when a content database has not been upgraded to be within the compatibility range of the Web server, or if the database has been upgraded to a higher level than the web server. The Web server and the database must be upgraded to the same version and build level to return to compatibility range.

I have read a lot of articles on Internet and tested install last updates for SP but still getting this error. Thank you for your help.

  • 2
    Hi, has your database pending upgrades, look for the database status on Central Admin > Manage Servers in this farm – Renzo Jun 7 '13 at 14:13
  • the status is "No Action required" for all databases – Medes Jun 10 '13 at 7:08
  • Provide few more background details, from when this is happening, Is the site migrated from sharepoint 2007 to 2010. – user851316 Jun 10 '13 at 9:12
  • No, it is not a migration project. It is a single SharePoint Farm Visual Studio 2012 project which contains only one visual web part. the above code. – Medes Jun 10 '13 at 10:06
  • Check if oyu can manually upgrade with this SharePoint Powershell: Upgrade-SPContentDatabase. Or try to run the SharePoint Product Configuration Wizard (PSCONFIG) – Marco Scheel Jun 10 '13 at 14:02
6

I tried increase the permissions(dbowner) for the App Pool Identity on CONTENT DB and the problem got resolved.

Error I got while issuing disable-spfeature is as below There is a compatibility range mismatch between the Web server and database "WSS_Content_CEDintra", and connections to the data have b een blocked to due to this incompatibility. This can happen when a content database has not been upgraded to be within the compatibility range of the Web server, or if the database has been upgraded to a higher level than the web server. The Web server and the database must be upgraded to the same version a nd build level to return to compatibility range.

2
+25

You should ensure the following:

  • If there are any outstanding updates on the farm so make sure to run: psconfig -cmd upgrade -inplace b2b -wait

    Use the Upgrade-SPContentDatabase cmdlet to resume a failed database upgrade or begin a build to build database upgrade against a SharePoint content database: Upgrade-SPContentDatabase WSS_Content

  • Check the application pool identity of the Web Part and the my site and user profiles databases, and see if they are different?. Ensure service accounts have required access.
  • Check the ULS/profile trace while debugging the code.
  • When I run psconfig -cmd upgrade -inplace b2b -wait it says:Failed to upgrade SharePoint Products. An exception of type Microsoft.SharePoint.Administration.SPUpdatedConcurrencyException was thrown. Additional exception information: An update conflict has occurred, and you must re-try this action. The object SPUpgradeSession Name=Upgrade-20130619-155230-143 was update d by MOGUL\kourosh.saleh, in the PSCONFIG (9452) process, on machine SRV-2013-KOSA. View the tracing log for more information about the conflict. – Medes Jun 19 '13 at 14:05
  • and when I run Upgrade-SPContentDatabase WSS_Content it says: WARNING: Database [SPContentDatabase Name=WSS_Content] does not need to be upgraded. – Medes Jun 19 '13 at 14:06
  • I don't understand exactly the third option. "Ensure Required access" where? all has full control permision on User Profile application service. – Medes Jun 19 '13 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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