AutoSPInstaller icon indicating copy to clipboard operation
AutoSPInstaller copied to clipboard

Fixes AccessDenied error on site collection creation

Open lkrn opened this issue 7 years ago • 3 comments

If there are no IIS sites prior to SharePoint installation (e.g., "Default Web Site" was removed) then "SharePoint Web Services" IIS site will be created with ID = 1. On new site collection creation, Stop-DefaultWebsite function wrongly assumes that IIS site with ID = 1 is the "Default Web Site" and stops it, which results in hard-to-debug issue (AccessDenied as SecurityTokenService is not available anymore). If really needed I can write function to check IIS bindings for site with ID = 1, or at minimum, check if site name is "SharePoint Web Services", but imho it's kind of stupid to stop any site with ID = 1 (what if it's some business app or WebAPI which uses its own port and do not interfere with SP).

lkrn avatar Feb 14 '18 16:02 lkrn

What about localized versions of IIS? In those cases, is the default web site still called "Default Web Site" ? I believe that's why I originally included the site ID as well.

brianlala avatar Feb 21 '18 17:02 brianlala

In those cases, is the default web site still called "Default Web Site" ?

Maybe not, but I'm pretty sure its physicalPath property will still have wwwroot directory no matter which language is used for IIS.

lkrn avatar Feb 24 '18 13:02 lkrn

Added check for http binding for website with ID=1. Removed useless Name check due to potential issue with localized versions of IIS.

lkrn avatar Feb 24 '18 13:02 lkrn