Archive for March, 2012

Fixing Error: An error has occurred while accessing the SQL Server database or the SharePoint Server Search service

March 27, 2012 Leave a comment

After re-pro-vising the User Profile Service Application in my SharePoint 2010 farm, and attempting to Configure Synchronization Connections I was receiving this error below that was preventing me from establishing a connection with AD.

An error has occurred while accessing the SQL Server database or the SharePoint Server Search service

To clear this error you simply run an IISReset on the server that hosts the User Profile Service Application.  Usually IIS recycles itself after pro-vising a new service app but in some cases it does not.  After running IISRESET the error should disappear and you can add your connection.

Fixing Corrupted applicationHost.config file in IIS 7

March 27, 2012 20 comments

Recently one of my SharePoint WFE’s servers applicationHost.config files became corrupted on the server.  Not sure how it happened or what caused it.  Might have been when I was trying to re-provision the User Profile Service Application.  Anyways IIS7 was erroring out with the error below when I tried to access the websites and application pools.  So all websites and web applications were unavailable.

The Windows Process Activation Service encountered an error trying to read configuration data from file ‘\\?\C:\Windows\system32\inetsrv\config\applicationHost.config’, line number ’1′. The error message is: ‘Configuration file is not well-formed XML’

When browsing to: C:\Windows\system32\inetsrv\config\applicationHost.config I noticed that the applicationHost.config files size was 0kb.  What?!  After opening up the file I noticed it was wiped clean.  Something went terribly wrong.  Luckily IIS7 automatically keeps the history of the applicationHost.config file every time there is a change in IIS7.

To access the history of the applicationHost.config file.

1.  Browse to C:\inetpub\history directory
2.  Inside this directory you will find the history of all the applicationHost.config file.
3.  Pick a applicationHost.config file that you know is not corrupted.  I usually pick one a few hours back to be safe.
4.  Copy the applicationHost.config file and paste it into the C:\Windows\system32\inetsrv\config directory, replacing the corrupted file.
5.  Now attempt to access IIS7 again.  This time IIS7 should open, and you should be able to access all your sites and web apps.

Thanks IIS7 for your history directory.

IIS7 URL Rewrite Redirect From SharePoint 2007 to SharePoint 2010

March 7, 2012 Leave a comment

After migrating from SharePoint 2007 to SharePoint 2010 I had to write some IIS7 URL Rewrites to redirect users from their old SharePoint 2007 Site Collection to their new SharePoint 2010 Site Collections for those people that might have bookmarked pages.

Below are the steps on how I accomplished this.

First if you have not done so already download and install the latest IIS7 Rewrite Module —  onto your SharePoint servers.  If your SharePoint environment is load balanced this will need to be done on all servers that are part of the load balancer.

Once in stalled…

1.  Open up Internet Information Services (IIS) Manager
2.  On the left side under Sites select the SharePoint Web Application website where you would like to create a URL rewrite.
3.  Under the IIS section select URL Rewrite
4.  Click the “Add Rules…” link under the Actions section on the right.
5.  Select the “Blank rule” template and click “Ok”
6.  Give the Rule a name (i.e) – Redirect

For this scenario i’ll be redirecting users from a SharePoint 2007 Site Collection to a SharePoint 2010 Site Collection i.e (http://portal2007/department/sales) to (http://portal2010/departments/sales).

7.  For Requested URL and Using keep these as default
8.  For Pattern enter:  (.*)
9.  Keep the Ignore Case box checked
10.  For Conditions keep Logical Grouping set to Match All
11.  Click the Add.. button to add a condition.
12.  For Condition Input enter: {URL}
13.  For Check if input string keep it as Matches the pattern
14.  For Pattern enter: sales(/.*)
15.  Test the pattern to make sure it works.
16.  Click Ok button.
17.  Under Action select Redirect for Action Type
18.  For Action Properties Redirect URL enter:  http://portal2010/departments/sales if you would only like to redirect to the root level site collection.
19.  If you would like to redirect to sub-directories you would enter:  http://portal2010/departments/sales{C:1}
20.  If you are using back-references i.e ({C:1}) make sure you check off the Append query string box.
21.  If this will be a permanent redirect select Permanent (301) for the Redirect Type.
22.  Click the Apply link on the top right under Actions
23.  Browse to your SharePoint 2007 Site Collection (http://portal2007/department/sales) and it should now auto redirect to (http://portal2010/department/sales).