asp.net core · litespeed litespeed proprietary, linux 3.9% gws (google web server) google custom...

33
ASP.NET Core Web Server IIS Deployment Hans-Petter Halvorsen https://www.halvorsen.blog

Upload: others

Post on 22-Jul-2020

39 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

ASP.NET CoreWeb Server IIS Deployment

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 2: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Introduction• Introduction to IIS deployment

• If you have never used ASP.NET Core, I suggest the following Videos:

– ASP.NET Core - Hello World https://youtu.be/lcQsWYgQXK4

– ASP.NET Core – Introductionhttps://youtu.be/zkOtiBcwo8s

2

Page 3: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

ScenarioDevelopment Environment Test/Production Environment

ASP.NET Core Web Application

Visual Studio

SQL Server Express

Local PC with Windows 10Windows 10/Windows Server

SQL Server

IIS

Visual Studio

ASP.NET Core Web Application

Page 4: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Web Server• A web server is server software that can satisfy client requests on the

World Wide Web. • A web server can contain one or more websites. • A web server processes incoming network requests over HTTP and

several other related protocols. • The primary function of a web server is to store, process and deliver

web pages to clients.• The communication between client and server takes place using the

Hypertext Transfer Protocol (HTTP). • Pages delivered are most frequently HTML documents, which may

include images, style sheets and scripts in addition to the text content.

4https://en.wikipedia.org/wiki/Web_server

Page 5: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Web Pages and Web Applications

Web Server

Operating System, e.g., Windows Server

Web Server software, e.g., Internet Information Services (IIS)

Client

PC with Windows 10, macOS or LinuxSmartphone with Android or iOS, etc.

Web Browser, e.g., Edge, Chrome, Safari, etc.

Request (URL)

Response(HTML)Data-

base

Internetor Local

Network (LAN)

Page 6: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Web Server Software

The term web server can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver web content that can be accessed through the Internet.The most common use of web servers is to host websites, but there are other uses such as gaming, data storage or running enterprise applications.

Internet Information Services

ASP.NETCross-platform: UNIX, Linux, OS X, Windows, ...

(pronounced "engine x") - Has become very popular lately

PHP

Page 7: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Web Servers Market share*

https://en.wikipedia.org/wiki/Web_server

Product Vendor Platform Percent

Apache Apache Open Source Cross Platform

44.3%

Nginx Nginx, inc Free + Paid versionsCross Platform

41.0%

IIS (Internet Information Services) Microsoft Windows, Included with Windows (Windows Server, Windows 10 Pro)

8.9%

LiteSpeed LiteSpeed Proprietary, Linux 3.9%

GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services

0.9%

*February 2019

Page 8: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS)

• Web Server software– “Included” (you need to activate/turn it on in

Windows Features) in Windows 10 and Windows Server

• Created by Microsoft

• You use Internet Information Services (IIS) Manager to configurethe system

8

Page 9: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Installation• Turn on Internet Information Services in

Windows Features

• Install the .NET Core Hosting Bundle on the IIS server.

– If the Hosting Bundle is installed before IIS, the bundle installation must be repaired. Run the Hosting Bundle installer again after installing IIS.

9

Page 10: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS)

Hans-Petter Halvorsen, M.Sc.

Page 11: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS)

• Web Server from Microsoft

• Integrated with Windows

https://en.wikipedia.org/wiki/Internet_Information_Services

Page 12: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS)• IIS – Internet Information Services

• Web Server that host the Web Pages/Web Site

• Make sure to have the IIS Role installed with ASP.NET subcomponents

Default IIS Directory:C:\inetpub\wwwroot

Page 13: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Installation/Configuration

You need to turn IIS on

Search for «Windows Features» or open the Control Panel

Page 14: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Publish an ASP.NET Core app to IIS

• Turn on Internet Information Services in Windows Features

• Install the .NET Core Hosting Bundle on the IIS server. The bundle installs the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module allows ASP.NET Core apps to run behind IIS.

14https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis

Page 15: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS) Manager

Page 16: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Deploy/Publish Web Service to IISCopy Web Service Files (Project) to default IIS Directory: C:\inetpub\wwwroot

Page 17: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

ASP.NET Core Web Application in Visual Studio

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 18: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

18

BookApp

Page 19: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

BookApp

• ASP.NET Core - Database CRUD Application

• YouTube: https://youtu.be/k5TCZDwTYcE

• Blog: https://halvorsen.blog/

• ASP.NET Core Resources: https://halvorsen.blog/documents/programming/web/asp_net.php

19

Page 20: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Visual Studio

20

Page 21: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Make Deployment Package

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 22: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

22

Right-click on the Project in the Solution Explorer and select “Publish”

Page 23: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Publish

23

Page 24: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

SQL Server

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 25: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Create Database

25

Use SQL Server Management Studio in order to create the Database

Page 26: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Create Tables, Views, Stored Procedures, etc.

26

Page 27: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

appSettings.json

27

Page 28: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Deploy to IIS

Hans-Petter Halvorsen

https://www.halvorsen.blog

Page 29: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Internet Information Services (IIS) Manager

29

Page 30: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Test Application

30

Page 31: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

31

Your Web Application is running on the Web Server!

Page 32: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Resources

• IIS Web Site: https://www.iis.net

• Host ASP.NET Core on Windows with IIS: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/

• Publish an ASP.NET Core app to IIS: https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis

32

Page 33: ASP.NET Core · LiteSpeed LiteSpeed Proprietary, Linux 3.9% GWS (Google Web Server) Google Custom Linux-based Web server that Google uses for its online services 0.9% ... NET Core

Hans-Petter Halvorsen

University of South-Eastern Norway

www.usn.no

E-mail: [email protected]

Web: https://www.halvorsen.blog