Create SharePoint web application (Central Admin & PowerShell)

In this SharePoint tutorial, we will discuss what is a SharePoint web application? How to create SharePoint web application from SharePoint central administration page and also how to create SharePoint web application using PowerShell.

We can use the same PowerShell script to create SharePoint web application in SharePoint 2013, SharePoint 2016, or SharePoint 2019.

What is a SharePoint web application

A SharePoint web application is a collection of one or more websites configured to map an HTTP request with a unique domain name. Each web application contains one or more site collections.

And each web application creates a content database and authentication method to connect to a database. The default website that is automatically created by IIS listens for incoming HTTP requests on port 80.

You can create additional IIS websites to provide additional HTTP entry points using different port numbers, different IP addresses, or different host headers.

When you create a web application in SharePoint Foundation, it creates an IIS website with a root folder containing a web. Configuration file at the following location:C:\inetpub\wwwroot\wss\VirtualDirectories. You can also find pool process for a web application once it is created from IIS manager.

  • A SharePoint web application is a collection of one or more IIS websites configured to map incoming HTTP requests to a set of SharePoint sites. A SharePoint 2013 web application is composed of an Internet Information Services (IIS) website that acts as a logical unit for the site collections that you create. The web application also maps each SharePoint site to one or more specific content databases. SharePoint Foundation uses content databases to store site content such as list items, documents, and customization information.
  • The default website that is automatically created by IIS listens for incoming HTTP requests on port 80. You can create additional IIS websites to provide additional HTTP entry points using different port numbers, different IP addresses, or different host headers.
  • When you create a web application in SharePoint Foundation, it creates an IIS website with a root folder containing a web.config file at the following location:
    C:\inetpub\wwwroot\wss\VirtualDirectories
  • A SharePoint on-premises farm typically runs two or more web applications. The first web application is created automatically when the farm is created. This web application is used to run SharePoint 2013 Central Administration. You need at least one additional web application to create sites that are used by business users.
  • There are various components of web application like the name of the IIS website, port, host header, location of the IIS files, whether or not to allow anonymous access, whether or not to use Secure Sockets Layer (SSL) authentication, the use of a default sign-in page, application pool, failover database server, search server, database name, and service application proxy group.
  • When you create a new web application, you also create a new content database and define the authentication method used to connect to the database.

Create SharePoint web application from Central Administration

Now, we will see how to create a web application in SharePoint 2013/2016 from central administration.

Step-1:
Open SharePoint 2016/2013 Central Administration and click on Application Management.

Create SharePoint web application
web application SharePoint

Step-2:
Click on Manage Web Applications and then click New.

create web application in sharepoint 2016
web application sharepoint 2016

Step-3:
Click Create a new IIS web site. Where we can find the following things:

On the Create New Web Application page, in the IIS Web Site section, you can configure the settings for a new Web application.

To choose to use an existing Web site, select Use an existing Web site, and then specify the Web site on which to install your new Web application by selecting it from the drop-down list.

To choose to create a new Web site, select Create a new IIS Web site, and then either accept the default name provided for you or type a new name for the Web site in the Description box.

In the Port box, type the port number that you want to use to access the Web application. If you are creating a new Web site, this field is populated with a suggested port number. If you are using an existing Web site, this field is populated with the current port number.

In the Host Header box, type the URL that you want to use to set the IIS host header binding. This is an optional field. Find more about the host header the following link.

In the Path box, type the path to the home directory on the server. If you are creating a new Web site, this field is populated with a suggested path. If you are using an existing Web site, this field is populated with the current path.

In the Allow Anonymous section, choose Yes or No. If you choose to allow anonymous access, this enables anonymous access to the Website by using the computer-specific anonymous access account (that is, IUSR_<computer name>).

In the Use Secure Sockets Layer (SSL) section, select Yes or No. If you choose to enable SSL for the Website, you must configure SSL by requesting and installing an SSL certificate.

sharepoint 2016 create web application
SharePoint 2016 create web application

Step-4:
In the Authentication Provider section, choose either Negotiate (Kerberos) or NTLM.

new-spwebapplication sharepoint 2016
new-spwebapplication SharePoint 2016

Step-5:
In the Application Pool section, choose whether to use an existing application pool or create a new application pool for this Web application. To use an existing application pool, select Use existing application pool. Next, select the application pool you want to use from the drop-down list.

To create a new application pool, select create a new application pool. In the Application pool name box, type the name of the new application pool, or keep the default name.

In the Select a security account for this application pool section, select Predefined to use an existing application pool security account and then select the security account from the drop-down menu.

Select Configurable to specify a new account to be used as a security account for an existing application pool. In the Username box, type the username of the account you want to use, and type the password for the account in the Password box.

In the Database Name and Authentication section, choose the database server, database name, and authentication method for your new Web application.

sharepoint 2016 web application
sharepoint 2016 web application

Step-6:
In server application connections we can see the default servers connections and settings associate with the applications provided. And helps you to choose the service applications that this Web application will be connected to.

how to create web application in sharepoint 2016 step by step
how to create web application in sharepoint 2016 step by step

Step-7:
Click on OK to create a new web application. Creating it will take some time where you need to be patient.

how to create web application in sharepoint 2013 step by step
create web application in sharepoint 2013 step by step

Sometimes you can incur a very long waiting time or Sometimes after the timeout as it will have created the database, the IIS website, but didn’t copy all contents into the Virtual Directory. We can go for PowerShell script.

Create a SharePoint web application using PowerShell

Now, we will see how to create a SharePoint web application using PowerShell.

By running the following PowerShell script, we can create a web application in SharePoint 2013/2016 or SharePoint 2019. You can run the PowerShell Script using Visual studio code or using windows powershell ise.

If you are new to SharePoint on-premises versions, then check out an article on How to use PowerShell in SharePoint Online/2016/2013.

SharePoint provides New-SPWebApplication PowerShell cmdlets that we can use to create a SharePoint web application in SharePoint on-premises versions.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "SP2016AppPool"
-ApplicationPoolAccount (Get-SPManagedAccount "TSINFO\Bijay") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

Below is the PowerShell command to create claim based authentication in SharePoint 2016/2013/2019.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$ap = New-SPAuthenticationProvider
New-SPWebApplication -Name "SP2016WebApp" -ApplicationPool "SP2016AppPoolAcc" -ApplicationPoolAccount (Get-SPManagedAccount "SPSky\Bijay") -URL "SP2016WebApp" -Port 3535 -AuthenticationProvider $ap

Once you run the code, you can see it will create the SharePoint web application like below:

PowerShell create web application in SharePoint 2016
PowerShell create web application in SharePoint 2016

Description:

There are some basic configure standard which we should follow to create web application
1. Add-PSSnapin “Microsoft.SharePoint.PowerShell”
SharePoint cmdlets are not available by default. This is because the ISE has not loaded up the SharePoint PowerShell Snap-ins.

2. New-SPWebApplication -Name “SharePoint 2016 Web App” :-
Here we have given a web application name as SharePoint 2016 Web App.

3. -Port 80
Port no 80

4. ApplicationPool “SP2016AppPool”
Here we have passed the application pool name which is SP2016AppPool

5. -ApplicationPoolAccount (Get-SPManagedAccount “TSINFO\Bijay”)
Here we provide managed account info which are active directory accounts whose credentials are managed by SharePoint.

These are the credentials passed as managed account info TSINFO\Bijay.

6. AuthenticationMethod NTLM
Authentication methods are used to drive uses while establishing a connection. Here NTLM AuthenticationMethod is used.

Database and application pool created after web application creation

As we know a database is created in a server as well as an application pool.
We can check the database behavior in the SQL server 2014 management studio and then click on the database. we can use search to get in SQL server 2014 management studio and get into the database and it is a big no to tamper data from the database directly.

In the following screenshot we can see there is no Database before any web application created only default database is created as SharePoint AdminContent database.

create new web application sharepoint 2013 powershell
create new web application SharePoint 2013 PowerShell

We can see the content database is created after a web application is being created

web application sharepoint 2013
web application sharepoint 2013

In the same way, can check application pool behavior in IIS Manager as a new application pool is being created when a web application gets created.

We run “inetmgr” command in a run window by pressing on windows+r

Here we can see an application pool is created and is been hosted in an IIS.

create new web application sharepoint 2016 powershell
create new web application SharePoint 2016 PowerShell

This is how we can create a web application in SharePoint 2019/2016/2013.

New-SPWebApplication ApplicationPoolAccount is not found

Recently I was trying to create a web application using PowerShell in SharePoint 2016. The error comes as New-SPWebApplication ApplicationPoolAccount is not found. You can write, execute, and debug the PowerShell script using Windows PowerShell ISE.

I was using the below PowerShell script:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "Sharepoint2016" -ApplicationPoolAccount (Get-SPManagedAccount "mama") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

And the error will come like below:

New-SPWebApplication ApplicationPoolAccount is not found

New-SPWebApplication ApplicationPoolAccount is not found
New-SPWebApplication ApplicationPoolAccount is not found

New-SPWebApplication ApplicationPoolAccount is not found

Here two things I have changed, one is we need to provide a domain account instead of the only username. I was using the account name as “mama”, so I modified to “domain name\user name” like “TSINFO\mama”.

The other point we need to check is that there should not be any line break in the New-SPWebApplication cmdlets. I have modified the cmdlet to like below and it successfully created the web application.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$authentication = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
New-SPWebApplication -Name "SharePoint 2016 Web App" -Port 80 -ApplicationPool "Sharepoint2016" -ApplicationPoolAccount (Get-SPManagedAccount "TSINFO\mama") -AuthenticationMethod NTLM -AuthenticationProvider $authentication

I hope, this helps to fix error New-SPWebApplication ApplicationPoolAccount is not found.

Request timed out error while Creating New Web Application in SharePoint

In this article, we will discuss how to resolve the below error while creating a new web application in SharePoint 2016. Recently after installing SharePoint 2016, when I tried to create a new SharePoint web application through SharePoint 2016 central administration, But after some time, it gave an error as: “Sorry, something went wrong, Request timed out”.

what is web application in sharepoint 2013
what is a web application in SharePoint 2016

Request timed out error while Creating New Web Application in SharePoint 2016

To resolve the issue we have to change the Shutdown Time Limit of the application pool.

Click window+r in the system. Type intmgr in the search box like below. Click on OK.

Sorry, something went wrong, Request timed out
Sorry, something went wrong, Request timed out

This will open Internet Information Service(IIS) Manager page. Expand TSINFOTECH(TSINFO\Administrator) which appear on the left side.

not able to create new web application in sharepoint 2013
not able to create new web application in SharePoint 2013

Select the Application Pools which is under TSINFOTECH(TSINFO\Administrator).

create new web application sharepoint 2016 powershell
create new web application SharePoint 2016 PowerShell

Select one Application Pools and right click on that we can able to see “Advanced Settings”. Click on “Advanced Settings”. From the right side navigation, we can also directly click on “Advanced Settings”.

powershell script to create web application in sharepoint 2013
PowerShell script to create web application in SharePoint 2013

In the “Advanced Settings,” we can able to see Shutdown Time Limit (seconds) option. By default the time will be 90 seconds, increase that to 300 seconds.

create webapplication powershell
create web application PowerShell

Otherwise, we can change the “Idle Time-out Reached” which is present under the “Generate Process Model Event Log Entry“. Change the “True” option to “False“.

PowerShell script to create web application in SharePoint 2016
PowerShell script to create web application in SharePoint 2016

This is how to resolve the Request Timed out issue while creating a new web application in SharePoint 2016.

You may like following SharePoint tutorials:

Conclusion

In this tutorial, we learned what is a SharePoint web application? How to create a SharePoint web application from the SharePoint central admin in SharePoint 2013/2016? And also, we saw how to create a web application in SharePoint 2016 using PowerShell. The same PowerShell script we can use to create a web application in SharePoint 2013.

  • Question: in a minrole multiserver environment where do you run this script? on the CA host machine or on one of the WFE devices ?

  • >