web apps and internet information...

67
Web Apps and Internet Information Services (IIS) Hans-Petter Halvorsen, M.Sc. Web Server Deployment

Upload: hoangkhanh

Post on 07-Mar-2018

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebAppsandInternetInformationServices(IIS)

Hans-PetterHalvorsen,M.Sc.

WebServerDeployment

Page 2: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Contents• IntroductiontoWebApps– HTMLExample

• IntroductiontoASP.NET– ASP.NETExample

• IntroductiontoWebServers• InternetInformationServices(IIS)– DeployaHTMLWebSitetoIIS– DeployanASP.NETWebApptoIIS

Page 3: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebPlatforms

PCswithWebBrowsers

ClientsServers

TheCloud/Internet/Local

Network

WebServers

DatabaseServers

HTML

HTML

Page 4: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebApps

Hans-PetterHalvorsen,M.Sc.

Page 5: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebBrowsers

MicrosoftEdge

InternetExplorer

Chrome

Opera

Firefox

Safari

Page 6: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

HTML• HyperTextMarkupLanguage(HTML)• TheVisualAppearanceofaWebSite• “WebBrowserLanguage”:AllWebBrowserunderstandHTML

• HTML5isthelatest• MaintainedbyW3C

- WorldWideWebConsortium

<!DOCTYPE html><html><body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body></html>

Page 7: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WYSIWYGHTMLEditors• AdobeDreamweaver(MonthlyPayment)• Kompozer (Free)• Bluegriffon (Free)• Sparkle($80),etc...OtherHTMLEditors(notWYSIWYG)• VisualStudio(ASP.NET)• CoffeeCup ($69,FreeTrial)• Coda($99)• ...

WYSIWYG– WhatYouSeeIsWhatYouGetYoudontneedtoknowHTMLsyntax- ItsjustlikeusingMSWord.

Onlypossible tochangetheHTMLsourcecodeandthenselect“Preview”inordertoseehowitlookslikeinaWebBrowser.YouneedtoknowHTMLsyntax

Page 8: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

HTML

JavaScriptCSS

WebProgramming

UseHTML todefinethecontentofwebpages

UseCSS tospecifythelayoutofwebpages

TheWebProgrammingTriangle

UseJavaScript toprogramthebehaviorofwebpages

Page 9: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CSS

JavaScriptWeb

Server

Page 10: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebArchitecture

WebServer

WebBrowserHTML JavaScriptCl

ient

CSS

Server-side

InternetExplorer Chrome Firefox Opera Safari

MicrosoftEdge

Page 11: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Client-ServerExample

Database

Client

WebServer

Request

Response

WebBrowser

InternetInformationServices(IIS),Apache,etc.

Page 12: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

<!DOCTYPE html><html><body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body></html>

WebPlatform

Client-side

Server-side

WebBrowser

WebServer

WebPage(HTML)

HTML,CSS,JavaScript

ASP.NET,PHP,...InternetInformationServices(IIS),Apache,etc.

ThecoderunsontheserveranditsconvertedtoHTMLbeforesending totheclient(Web

Browser)

TheWebBrowsercreatesthevisualwebpageyouseeinthebrowserbasedontheHTMLcode

Page 13: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Example

Hans-PetterHalvorsen,M.Sc.

HTMLWebPage

Page 14: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

SimpleHTMLPageExample

14

<!DOCTYPE html><html><body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body></html>

HTMLCode

WebBrowser:

Page 15: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InthisExamplewewillcreateasimpleHTMLpageusingNotepadonly

Saveas.htmfileandopenfromFileExplorer

Page 16: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InthisExamplewewillcreateasimpleHTMLpageusingNotepadonly

Page 17: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ASP.NETWebApps

Hans-PetterHalvorsen,M.Sc.

Page 18: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebServer

ASP.NETC#/VB.NET

.NETFramework

WebBrowser

HTML JavaScriptServer-side

Client

ASP.NET

CSS

Theserver-sideASP.NETpagesareconvertedontheservertoHTMLpagesbeforeitissenttotheclient

ASP.NETisusedtocreatedynamicwebpages

Page 19: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebSites

ASP.NETC#/VB.NET

.NETFramework

ASP.NETWebPages

ASP.NETWebForms

ASP.NETMVC

ASP.NET– DifferentwaysofcreatingWebSiteswithASP.NET

http://www.asp.net

Youcanuse(atleast)3differentapproacheswhencreatingWebSiteswithASP.NET

Page 20: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ASP.NETWebPages

ASP.NETWebForms

ASP.NETMVC

• SimilartothedesktopdevelopmentmodelusedinWPF• GUI(*.aspx files)andCode(*.aspx.cs)separatedindiff.Files• ForthosewhoarefamiliarwithWinForms,.NET,WPF,etc.

• MVC– Model- View– Controller• Anewdevelopmentmodelwhereyousplityourdevelopment

into3parts/components:ModelsforData,ViewsforDisplayandControllersforInput.For“Advanced”Developers

• SingePageModel(Theserver-sidecodeismixedinbetweentheHTML)

• UsestheRazorsyntax(.cshtmlfiles)• SimiliarasClassicASPandPHP• AtoolcalledMicrosoftWebMatrixisoptimizedforthis

developmentmodel,butyoucanalsouseVisualStudioifyouwantto.

Page 21: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ASP.NETWebFormsCreateaNewProjectinVisualStudio

Page 22: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Example

Hans-PetterHalvorsen,M.Sc.

ASP.NETWebFormApp

Page 23: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ASP.NETWebFormExampleWhenyouarefinished,yourWebAppshouldlooksomethinglikethis:

WhenyouenteryourNameintheTextBox andclicktheOKButton,theprogramshouldrespondwithagreetings.

Page 24: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Title(ordinaryHTMLtext,orLabel)

TextBox ButtonLabel

Label

Page 25: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

LetscreatethisExamplewithVisualStudio

Page 26: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebServer

Hans-PetterHalvorsen,M.Sc.

Page 27: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebServerPlatforms

Thetermwebservercanrefertoeitherthehardware(thecomputer)orthesoftware(thecomputerapplication)thathelps todeliverwebcontentthatcanbeaccessedthroughtheInternet.Themostcommonuseofwebserversistohostwebsites, butthereareotherusessuch asgaming,datastorageorrunningenterpriseapplications.

InternetInformationServices

ASP.NETCross-platform:UNIX,Linux,OSX,Windows, ...

(pronounced "enginex")- Hasbecomeverypopularlately

PHP

Page 28: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebServerPopularity

http://news.netcraft.com/archives/2015/09/16/september-2015-web-server-survey.html

Page 29: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)

Hans-PetterHalvorsen,M.Sc.

Page 30: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)

• WebServerfromMicrosoft• IntegratedwithWindows

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

Page 31: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)• IIS– InternetInformationServices• WebServerthathosttheWebPages/WebSite• MakesuretohavetheIISRoleinstalledwithASP.NETsub

components

DefaultIISDirectory:C:\inetpub\wwwroot

Page 32: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Installation/Configuration

YouneedtoturnIISon

Searchfor«Windows Features»oropentheControlPanel

Page 33: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)Manager

Page 34: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Deploy/PublishWebServicetoIISCopyWebServiceFiles(Project)todefaultIISDirectory:C:\inetpub\wwwroot

Page 35: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Example

Hans-PetterHalvorsen,M.Sc.

DeployHTMLWebSitetoIIS

Page 36: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example
Page 37: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

IISDeployment<!DOCTYPE html><html><body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body></html>

Page 38: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

IISDeployment

TestyourWebPageinyourWebbrowser

“localhost”isyourpersonalcomputer, youcamalsouse

yourIPaddress.

Page 39: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebServer

YourDevelopmentPC PCwithWebBrowser

Clients

WebPageDevelopment

ToolE.g.VisualStudio

Page 40: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

SimpleHTMLPageExample

40

<!DOCTYPE html><html><body>

<h1>My First Heading</h1>

<p>My first paragraph.</p>

</body></html>

HTMLCode

WebBrowser:

Page 41: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example
Page 42: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Example

Hans-PetterHalvorsen,M.Sc.

DeployASP.NETWebApptoIIS

Page 43: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CreateWebAppinVisualStudio

Page 44: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CreateWebAppinVisualStudio

Page 45: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CreateandTestWebAppinVisualStudio

Page 46: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)Manager

1

2

3

RenameyourWebForm orAddNewDefaultDocument

CopyyourVisualStudioProject

AddyourApplication inIISManager

ThenTestyourWebApp4

Page 47: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

TestIt

NotWorking?• Installcorrect.NETFrameworkintheVirtual

Machine• MakesuretheIISUserhasaccess(“owner”or

“read/write”)totheSQLServerDatabase

Page 48: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example
Page 49: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Example

Hans-PetterHalvorsen,M.Sc.

DeployASP.NETWebAppswithVisualStudio

Page 50: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Deployment/PublishAlternatives:- Createa“InstallationPackage”thatyouortheCustomerneedtoinstallontheserver(WebDeployPackage)

- Deploydirectlytotheserverusing“WebDeploy”(Youneedtohaveonlineaccesstotheserver)

- Deploydirectlytotheserverusing“FTP”(Youneedtohaveonlineaccesstotheserver)

- FileSystem

50

Page 51: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

DeploymentAlternative#1

Hans-PetterHalvorsen,M.Sc.

FileSystemDeployment

Page 52: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

FileSystemDeploymentRight-clickon theASP.NETProjectintheSolutionExplorerinVisualStudioandselect“Publish...”

Copy«MyWebApp»TotheIISFolder(inetpub/wwwroot)

Page 53: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

InternetInformationServices(IIS)Manager

1

2

3

RenameyourWebFormorAddNewDefaultDocument

CopyyourVisualStudioProject

Then Testyour WebApp

AddyourApplication inIISManager

4

Page 54: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

TestIt!

Page 55: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example
Page 56: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

DeploymentAlternative#2

Hans-PetterHalvorsen,M.Sc.

WebPackageDeployment

Page 57: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebPackageDeployment

Right-clickon theASP.NETProjectintheSolution ExplorerinVisualStudioandselect“Publish...”

Page 58: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Ifyoumissthe“Deploy”option,makesuretoinstallthe“WebDeploy”features.YoumaydownloadandinstallitfromWebPI(WebPlatformInstaller)(Googleitanddownloadit)

Page 59: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CreateWebPackageWizard

Page 60: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

CreateWebPackageWizardIfyourWebAppusesaDatabaseconnectioninWeb.config, youmaysetuptheConnectionStringontheServerhere.

YoumayfillintheConnectionString totheDatabase

Page 61: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

PreparationYoumayneed toinstallthe“WebDeploy”softwareontheServerDownloadWebPI(WebPlatformInstaller)andthenselecttoInstall“WebDeployforHostingServers”

Page 62: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ImportPackageinIIS

Page 63: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

ImportPackageinIISMakesureyouhavecopied theInstallationPackagetotheServer

Page 64: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

WebPackageDeployment

Page 65: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

TestIt

Page 66: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example
Page 67: Web Apps and Internet Information Serviceshome.hit.no/~hansha/documents/software/software_development/topics...Web Apps and Internet Information Services (IIS) ... Client-Server Example

Hans-PetterHalvorsen,M.Sc.

UniversityCollegeofSoutheastNorwaywww.usn.no

E-mail:[email protected]:http://home.hit.no/~hansha/