1
votes

I am building a SharePoint 2016 farm using PowerShell scripts.

The SharePoint farm server topology is: - one WFE server (Front-end with Distributed Cache) - one application server (Application with Search) - one search server (Search) and - one database server

Central Administration is on application server. Web application provisioning PowerShell script is like this:

$params = @{
    Name                   = $webAppName;
    ApplicationPool        = "$($applicationPool.Name)";
    ApplicationPoolAccount = "$($applicationPool.ProcessAccountName)";
    AllowAnonymousAccess   = $allowAnonymousAccess;
    AuthenticationMethod   = $authenticationMethod;
    DatabaseName           = $databaseName;
    DatabaseServer         = $databaseServer;
    HostHeader             = $hostHeader;
    Url                    = $publicUrl;
    Path                   = $path;
    Port                   = $port;
    SecureSocketsLayer     = $useSSL;
}

if($useWindowsClaims) 
{ 
    $params["AuthenticationProvider"] = $(New-SPAuthenticationProvider) 
}

# create the web application
$webApp = New-SPWebApplication @params -WarningAction SilentlyContinue

My question is: On which SharePoint Server (WFE or application) should this PowerShell script be executed in order to create Web Application in the best way?

My first thought was that the script should run on application server because it hosts Central Administration . Then I thought that the location of script execution should not matter and running it on either WFE or application server would produce the same farm configuration stored in SharePoint Configuration database.

Anyway, I ran the script first on application server:

  1. Application pools and sites were created on both servers (Seen in IIS on both servers)
  2. Site can browse in IIS on application server, but not in IIS on WFE server. (This is not desired and I want WFE to handle the user web requests)

Then I deleted the web application with site collection and ran the script again on WFE server.

  1. Application pools and sites are created on both servers (Seen in IIS on both servers)
  2. Site can browse in IIS on WFE server, but not on application server. (This works for me. But should IIS on application be able to browse to site also?)

As you see, the difference is which server's IIS can browse to the site (or which server handles web requests). So further questions are:

  1. Should the site be able to browse on both application and WFE servers? If yes, how to make so?
  2. Is this difference normal/expected?
  3. Is the difference caused by some settings/configurations? (such as certain service not started?
  4. Does it matter to register SharePoint URL in DNS before or after running script?

Thank you.

1

1 Answers

0
votes

Generic scripts that create things like web apps or site collections, etc. can be run from any SharePoint server in the farm. There is absolutely no problem to run things from where ever. As to your questions

  1. As for can you browse to your newly created web application on the current server depends on two things. A.) Is the Microsoft SharePoint Foundation Web Application Service provisioned on the local machine. This is what SharePoint creates the IIS sites that corresponds to your SPWebApplications. In a multiserver SharePoint farm, wherever this service is running, SharePoint will create a SPWebApplication. Deprovision the service from the box, and the SPWebApplications go away to. B.) Does DNS resolution either from true DNS or your local HOSTS file get you to the box using the web application hostname you used when creating the web application.

  2. You can see some quirks in the case where new application pools are created. IIS often needs a reset before things completely work properly in multi-server environments.

  3. See above.

  4. You don't have to have the DNS entry made ahead of time but if you aren't going to, it is often easier on yourself to make HOST file entries so that things will work out the way that you expect in the browser.