Tuesday, December 16, 2008

MOSS out of the box search error

Recently while configuring the out of the box search for a MOSS site, I encountered the following error : Your search cannot be completed because of a service error. Try your search again or contact your administrator for more information.
In order to fix the error, please make sure the application pool, the site is running under, has access to the search index. Here are the steps to follow:

  • First make sure the MOSS Search Service is running. Check the event viewer for error messages. If everything is ok, go to the next step
  • Find out the application pool account the site is running under(network service, local account or another account)
  • Go to Central administration -> SSP settings -> Search
  • Check the default content access and make sure it is the same as the above one

Thursday, December 4, 2008

MOSS SSP URL

In order to get the SSP URL of the farm, we can use the following piece of code. This is really helpful if you don't want to hardcode the SSP URL.
   1:  private string getSSPURL()
   2:  {
   3:     string uri = string.Empty;
   4:     ServerContext sc = ServerContext.Default;
   5:     object ssp = sc.GetType().GetProperty("SharedResourceProvider",
                       BindingFlags.Instance | BindingFlags.NonPublic).GetValue(sc, null);
   6:     Guid sspGuid = (Guid)ssp.GetType().GetProperty("AdministrationSiteId").GetValue(ssp, null);
   7:     using (SPSite sspSite = new SPSite(sspGuid))
   8:     {
   9:       uri = sspSite.WebApplication.GetResponseUri(SPUrlZone.Default).AbsoluteUri + "ssp/admin";
  10:     }
  11:     return uri;
  12:  }