Saturday, October 13, 2012

Server error in '/' Application - The Resource cannot be found - Solution

In a SharePoint 2007 environment, called for fixing a issue: All SharePoint sites appeared with an error"SharePoint server error in '/' Application The Resource cannot be found. "

Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested Url: /sites/marketing/default.aspx

I know this is a really common error, usually this error occurs when some resources like Master pages, User controls, etc referenced by SharePoint site doesn't exist (or got deleted!). In this case, client applied a master page via custom WSP Solution, and the code deleted master page with out changing it to default master page.
Server error in '/' Application - The Resource cannot be found - SolutionSites reported "File Not Found" Error initially. After enabling stack trace and disabled custom error message in web.config file, all SharePoint sites appeared with an error"SharePoint server error in '/' Application The Resource cannot be found. "

All Application pages were accessible since they use different master page. All content pages were failing because the master page referenced by them got deleted!

Went to the view source of the page, Analyzed and found it is referencing to a master page "crescent.master" that doesn't exists!

To fix the issue: Tried setting a different master page via SharePoint designer, Error disappeared!

But we can't open each and every site and set master page, isn't it? Automation? PowerShell! Here is the PowerShell script to Reset master pages to "Default.master" for all sites of a site collection.

#Set-ExecutionPolicy RemoteSigned

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null

#For SharePoint 2007
function global:Get-SPSite($url){
    return new-Object Microsoft.SharePoint.SPSite($url)
#Get the site collection
Write-Host "Enter the Site Collection URL:"
$SiteCollURL= Read-Host
$SPSite = Get-SPSite($SiteCollURL)

    # Change Master Page for all webs
       foreach($SPweb in $SPSite.AllWebs)
   $SPWeb.CustomMasterUrl = "/_catalogs/masterpage/default.master"
          $SPWeb.AlternateCssUrl = ""

Other Causes & Solutions:
This error may occur when you edit page layouts in SharePoint designer( SPD converts the URL path that start with: "~/site/page/file.aspx" to "site/page/file.aspx")

Solution: Reset the master page! Just go to "http://YOUR-SITE/_Layouts/ChangeSiteMasterPage.aspx" page and change the master page to default.master.

Sometimes, IIS may the culprit. Check these settings in IIS:
  • This may happen when there is a Port conflict in IIS. Stop any other sites running on the same port. 
  • IIS configurations like Web Site's Home Directory path change could cause this issue. Make sure the Home directory exists (Its case sensitive, by the way!)
  • Make sure there is no conflict between Virtual Directory folder and your site (They both can't be in same name)

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

1 comment :

  1. Thank you!
    The error must have been added 'invisible' during an update.
    Something always showed on the page before. This is totally invisible.


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...