HOSTING NOTE

Web Hosting Explained: Linux vs Windows Hosting, Localhost, Root Directory and IIS in ASP.NET Core (2026)

Introduction

Web hosting is a service that makes websites and web applications accessible over a network, usually the internet.

When developing applications using HTML, CSS, JavaScript, ASP.NET MVC, or ASP.NET Core, it is important to understand how web hosting works.

Developers should know the difference between Linux and Windows hosting, the purpose of localhost, how port numbers work, and where website files are stored on a server.

In this tutorial, we will explain these concepts with practical examples for beginners and .NET developers.

1. What Is Web Hosting?

Web hosting provides the computing resources and software environment required to run a website or web application.

A hosting environment may include:

  • A physical server or virtual machine

  • An operating system such as Linux or Windows

  • Web server software

  • Website files and application code

  • Network connectivity

  • Domain name and DNS configuration

  • SSL/TLS certificates for HTTPS

For example, when someone opens a website:

https://www.example.com

the browser resolves the domain name, establishes a network connection, and sends an HTTP request to the appropriate server.

The server processes the request and returns a response.

2. What Is Linux Hosting?

Linux hosting uses a Linux-based operating system to host websites and applications.

Common Linux web servers include:

  • Apache HTTP Server

  • Nginx

  • LiteSpeed

  • Caddy

Linux hosting can run static HTML websites and dynamic applications built with PHP, Python, Node.js, Java, and ASP.NET Core.

Common Linux Hosting Directories

Depending on the hosting provider and server configuration, website files may be stored in directories such as:

/var/www/html/

or:

/home/username/public_html/

Example Linux Website Structure

/var/www/html/
│
├── index.html
├── about.html
├── css/
│   └── style.css
├── js/
│   └── site.js
└── images/
    └── logo.png

The directory /var/www/html is a common default document root on some Linux web server installations.

However, the actual document root depends on the server and hosting configuration.

Important: Linux hosting is not limited to HTML websites. Modern ASP.NET Core applications can also run on Linux.

3. What Is Windows Hosting?

Windows hosting uses Microsoft Windows Server or another supported Windows environment to host websites and web applications.

Microsoft Internet Information Services (IIS) is commonly used as the web server.

Windows hosting is frequently used for:

  • ASP.NET Framework applications

  • ASP.NET MVC 5

  • ASP.NET Web Forms

  • ASP.NET Core applications

  • IIS-hosted websites

  • Applications integrated with Windows-specific technologies

Common Windows Hosting Directory

A default IIS website often uses:

C:\inetpub\wwwroot\

Example:

C:\inetpub\wwwroot\
│
├── index.html
├── css\
│   └── style.css
├── js\
│   └── site.js
└── images\
    └── logo.png

Some hosting providers use directories such as:

httpdocs

or:

wwwroot

The directory name depends on the hosting provider and control panel.

The httpdocs directory is commonly associated with Plesk hosting environments and is not exclusive to Windows.

4. Linux Hosting vs Windows Hosting

FeatureLinux HostingWindows Hosting
Operating systemLinuxWindows Server
Common web serversApache, Nginx, LiteSpeedIIS
Static HTML websitesSupportedSupported
PHPSupportedSupported with suitable configuration
ASP.NET CoreSupportedSupported
ASP.NET Web FormsNot natively supportedSupported on .NET Framework
ASP.NET MVC 5Not natively supportedSupported on .NET Framework
Node.jsSupportedSupported
SQL ServerSupported on compatible Linux environmentsSupported
Common document root/var/www/htmlC:\inetpub\wwwroot
Path separator/\ in typical Windows file paths

Which Hosting Is Best for ASP.NET Core?

ASP.NET Core supports both Linux and Windows hosting.

Choose Linux hosting when you want a Linux-based deployment environment, such as Nginx with Kestrel.

Choose Windows hosting when your application requires IIS integration or Windows-specific dependencies.

For traditional ASP.NET Web Forms and ASP.NET MVC 5 applications targeting the .NET Framework, Windows hosting is generally required.

5. What Is Localhost?

Localhost is a hostname that refers to the local computer.

It commonly resolves to loopback IP addresses:

127.0.0.1

for IPv4, and:

::1

for IPv6.

Developers use localhost to access applications running on their own computers.

Example

http://localhost:5000

This URL accesses a service listening on port 5000 on the local machine.

Important: ASP.NET is not restricted to localhost. Applications can run locally during development and be deployed to publicly accessible servers.

6. What Does the Colon (:) Mean in a URL?

The colon has different purposes depending on its position in a URL.

Consider:

http://localhost:5000

Here:

  • http is the URL scheme.

  • : after http separates the scheme from the rest of the URL.

  • // introduces the authority portion of the URL.

  • localhost is the hostname.

  • :5000 specifies the port number.

URL Structure

https://www.example.com:8443/products
ComponentValueMeaning
SchemehttpsHTTPS protocol
Hostnamewww.example.comServer hostname
Port8443Network port
Path/productsRequested resource path

The colon before 8443 separates the hostname from the port number.

It is not a host-finding operator.

7. What Is a Port Number?

A port number identifies a network communication endpoint on a host.

Web applications use ports to receive HTTP and HTTPS requests.

Common Port Numbers

PortCommon Usage
80HTTP
443HTTPS
5000Common ASP.NET Core development example
5001Common ASP.NET Core HTTPS development example
8080Common alternative HTTP port
8443Common alternative HTTPS port

Port numbers such as 5000 and 5001 are examples, not universal defaults for every ASP.NET Core project.

The actual port depends on application settings, launch profiles, environment variables, or server configuration.

8. What Is a Root Directory?

A root directory is the top-level directory within a particular filesystem or directory hierarchy.

In web hosting, the term document root commonly refers to the directory from which a web server serves website files.

Linux Example

/var/www/html/

The leading / represents the root of the Linux filesystem.

Windows Example

C:\inetpub\wwwroot\

Here, C:\ represents the root directory of the C drive.

Web URL Example

https://example.com/images/logo.png

The path /images/logo.png begins at the root of the website's URL path space.

A URL path does not necessarily correspond directly to a physical filesystem path because web servers and application frameworks can use routing and virtual mappings.

9. What Is wwwroot in ASP.NET Core?

In ASP.NET Core, wwwroot is the conventional web root directory used to store publicly accessible static assets.

Common files include:

  • CSS stylesheets

  • JavaScript files

  • Images

  • Fonts

  • Other static assets

Example Project Structure

MyAspNetCoreApp/
│
├── Controllers/
├── Models/
├── Views/
│
├── wwwroot/
│   ├── css/
│   │   └── site.css
│   ├── js/
│   │   └── site.js
│   └── images/
│       └── logo.png
│
├── appsettings.json
├── Program.cs
└── MyAspNetCoreApp.csproj

When static file serving is configured, files inside the web root can be served to browsers.

For example:

https://example.com/css/site.css

may map to:

wwwroot/css/site.css

Do not place passwords, private documents, or sensitive configuration files in a publicly served static file directory.

10. What Is IIS in Windows Hosting?

IIS stands for Internet Information Services.

It is Microsoft's web server software for Windows.

IIS can host static websites, traditional ASP.NET applications, and ASP.NET Core applications.

Common IIS Features

  • Website and application management

  • HTTPS bindings

  • Application pools

  • Authentication options

  • Logging

  • Request filtering

  • Reverse proxy integration through supported modules

Hosting ASP.NET Core on IIS

ASP.NET Core applications hosted on IIS typically use the ASP.NET Core Module.

Depending on the hosting model, the application can run in-process with IIS or out-of-process using Kestrel behind IIS.

The required .NET runtime and ASP.NET Core Hosting Bundle must be installed when applicable to the deployment model.

11. What Is Kestrel in ASP.NET Core?

Kestrel is the cross-platform web server included with ASP.NET Core.

It handles HTTP requests and can run on Windows, Linux, and macOS.

Kestrel can be used directly or behind a reverse proxy such as IIS or Nginx.

Example: Run ASP.NET Core Locally

Open a terminal in your ASP.NET Core project directory.

dotnet run

The application starts using its configured URLs and ports.

The terminal output typically indicates which addresses the application is listening on.

12. How to Host ASP.NET Core on Linux

A common Linux deployment architecture uses Nginx as a reverse proxy and Kestrel as the application server.

User Browser
     |
     v
HTTPS Request
     |
     v
Nginx Web Server
     |
     v
Kestrel
     |
     v
ASP.NET Core Application
     |
     v
HTTP Response

Basic Deployment Steps

  1. Prepare a supported Linux server.

  2. Install the appropriate .NET runtime or publish a self-contained application.

  3. Publish the ASP.NET Core project.

  4. Copy the published application to the server.

  5. Configure a service manager such as systemd.

  6. Configure Nginx as a reverse proxy.

  7. Configure HTTPS and appropriate firewall rules.

  8. Start the application and verify the deployment.

Publish Command

dotnet publish -c Release -o ./publish

This creates the published application files inside the publish directory.

The exact deployment steps depend on the hosting provider, .NET version, and application requirements.

13. How to Host ASP.NET Core on Windows IIS

A typical IIS deployment involves the following steps:

  1. Install IIS on Windows Server.

  2. Install the required .NET runtime and ASP.NET Core Hosting Bundle when applicable.

  3. Publish the ASP.NET Core application.

  4. Create an IIS website or application.

  5. Configure the physical path to the published files.

  6. Configure the application pool appropriately.

  7. Set up domain bindings and HTTPS.

  8. Configure file permissions.

  9. Start the website and verify application logs.

Publish Command

dotnet publish -c Release -o C:\Publish\MyApp

For a typical ASP.NET Core application hosted with the ASP.NET Core Module, the IIS application pool is configured with No Managed Code, because the ASP.NET Core runtime manages the application.

14. Difference Between Localhost and Live Server

FeatureLocalhostLive Server
PurposeLocal development and testingHosting applications for intended users
AccessUsually local machineNetwork or internet, depending on configuration
Examplelocalhost:5000www.example.com
DomainUsually localhostCustom domain or server address
HTTPSCan use development certificatesShould use trusted certificates
DebuggingCommon during developmentUsually uses logs and monitoring

A local application can also be exposed to other devices when explicitly configured, so localhost and live hosting describe common usage rather than an absolute technical restriction.

15. Common Web Hosting Mistakes

Mistake 1: Assuming Linux Hosting Supports Only HTML

Linux can host static websites and many dynamic application frameworks, including ASP.NET Core.

Mistake 2: Assuming httpdocs Is a Windows-Only Folder

The httpdocs directory is used by certain hosting control panels and is not exclusive to Windows.

Mistake 3: Confusing wwwroot with the Operating System Root

ASP.NET Core's wwwroot is the application's conventional static web root, not the root of the entire operating system.

Mistake 4: Assuming ASP.NET Always Uses Localhost

Localhost is commonly used during development. ASP.NET applications can also be deployed to servers accessible through domains or IP addresses.

Mistake 5: Exposing Sensitive Files in the Web Root

Private configuration, credentials, and sensitive files should not be stored in publicly served directories.


Frequently Asked Questions

What is the difference between Linux hosting and Windows hosting?

Linux hosting runs on Linux operating systems and commonly uses Apache or Nginx. Windows hosting runs on Windows Server and commonly uses IIS.

Can ASP.NET Core run on Linux hosting?

Yes. ASP.NET Core is cross-platform and can run on supported Linux environments.

What is localhost in ASP.NET?

Localhost refers to the local computer and is commonly used to access applications during development.

What does localhost:5000 mean?

It identifies a service on the local machine listening on network port 5000.

What is the default root folder in IIS?

The default IIS website commonly uses C:\inetpub\wwwroot, although administrators can configure a different physical path.

What is the purpose of wwwroot in ASP.NET Core?

The wwwroot directory is the conventional location for publicly accessible static files such as CSS, JavaScript, and images.

Is httpdocs the same as wwwroot?

Both names may be used for web document directories, but their exact purpose depends on the hosting environment. ASP.NET Core's wwwroot specifically refers to its configured static web root by convention.

Which hosting is best for ASP.NET Core?

Both Linux and Windows hosting are suitable. The choice depends on infrastructure, operational requirements, application dependencies, and deployment preferences.

Conclusion

Understanding web hosting is essential for developers building websites and ASP.NET applications.

Linux hosting and Windows hosting both support modern web development, but they differ in operating systems, server software, and deployment configurations.

Localhost is commonly used for development, while production applications are deployed to servers accessible through appropriate network addresses and domains.

For ASP.NET Core, developers should understand the difference between the application directory, static web root, hosting environment, and web server configuration.

These concepts help developers deploy, manage, and troubleshoot applications more effectively.

Official Microsoft Documentation


Comments