SharePoint 2013 and 404 on Every Site

In my lab environment the other day I started receiving a 404 from *all* of my SharePoint sites. So you being checking the usual suspects like the ULS logs and the event logs, but there were no errors note. One of my colleagues asked about the IIS logs and the sub-status code for the 404. As it turns out it was a 2, which according to this article means: ISAPI or CGI restriction

So that’s all well and good, but it didn’t get me any closer to what was happening. I looked in the IIS Manager and there were no disallowed ISAPI filters and all the .Net extensions were listed as would be normally.

After fighting with this for a couple of hours and having some peers looking over my shoulder we couldn’t shake the feeling that we were missing something simple. The HTTP error sub-status code was the clue we just weren’t putting the pieces together properly.

At this point we compared my lab server to a known good server that was working and it was pretty easy to see. For some reason – that I still do not know today – all of the SharePoint Foundation 2010 ISAPI filter entries were gone from my server. After adding them back manually:

fmvkvm

everything started working again…more or less normally….and don’t ask me why the ISAPI filter description is SharePoint Foundation 2010 for the SharePoint Server 2013 product. My favorite saying in times like this is “I wasn’t there when they were asking for opinions”.

Powershell for Super Bowl

I’m sure this has been done before and likely in a more elegant fashion, but I was sitting at my desk preparing for my Super Bowl gathering of friends and wanted a different way to select the numbers for the squares than just picking numbers from a hat. Now don’t get me wrong… hats work great especially for a small set of numbers like we are discussing here (0 – 9)… twice… but since I was sitting at my desk and I’m trying to be more dev minded in my daily tasks I thought I’d give Powershell a shot.

I knew they had added a cmdlet Get-Random to Powershell and that should make it easy, but I also needed to add code to make sure we didn’t ‘randomly’ re-select any numbers. Easy enough using a array… so here’s the final product and please keep criticism to a minimum as I’m the stereo-typical IT person that enjoys writing code, but I am far from a developer. J I do invite suggestions for making it better/different as I firmly believe the more ways you know how to accomplish a task the better off you’ll be.

# Originally written by Brian Gregor for the purpose of filling out a 
# Super Bowl squares sheet of 0-9. The get-random cmdlet will not 
# select the max value so for 0-9 you must enter 0 as min and 10 as max

# array to represent numbers already selected
$returned = @()

$min = Read-Host 'Minimum number in range'
$max = Read-Host 'Maximum number in range'

Read-Host 'Press <enter> to retrieve first random number'

# Loop and continue to get numbers checking that they have not
# been retrieved previously
do{
    $number = Get-Random -Minimum $min -Maximum $max
    if(($returned -eq 0) -or (!$returned.Contains($number)))
    {
        Write-Host $number
        $returned = $returned + $number        

        # if all numbers between min/max have been retrieved, then set exit $response
        if($returned.Count -ne ($max - $min))
        {
            $response = Read-Host "Retrieve another number? (Y/N)"        
        }
        else
        {
            $response = "N"
        }
    }
}
until($response.ToUpper() -eq "N")

Write-Host 'Numbers retrieved: '
foreach($number in $returned)
{
    Write-Host $number
}

This script can be downloaded from here.