Download Web Apps and Internet Information Services

Document related concepts
no text concepts found
Transcript
WebAppsandInternet
InformationServices(IIS)
WebServerDeployment
Hans-PetterHalvorsen,M.Sc.
Contents
• IntroductiontoWebApps
– HTMLExample
• IntroductiontoASP.NET
– ASP.NETExample
• IntroductiontoWebServers
• InternetInformationServices(IIS)
– DeployaHTMLWebSitetoIIS
– DeployanASP.NETWebApptoIIS
WebPlatforms
Servers
Clients
HTML
TheCloud/
Internet/
Local
Network
WebServers
DatabaseServers
HTML
PCswithWebBrowsers
WebApps
Hans-PetterHalvorsen,M.Sc.
WebBrowsers
InternetExplorer
Firefox
MicrosoftEdge
Chrome
Safari
Opera
HTML
• HyperText MarkupLanguage(HTML)
• TheVisualAppearanceofaWebSite
• “WebBrowserLanguage”:AllWebBrowser
understandHTML
<!DOCTYPE html>
<html>
• HTML5isthelatest
<body>
• MaintainedbyW3C
<h1>My First Heading</h1>
- WorldWideWeb
Consortium
<p>My first paragraph.</p>
</body>
</html>
WYSIWYGHTMLEditors
•
•
•
•
AdobeDreamweaver(MonthlyPayment)
Kompozer (Free)
WYSIWYG– WhatYouSeeIsWhatYouGet
YoudontneedtoknowHTMLsyntax- Its
Bluegriffon (Free)
justlikeusingMSWord.
Sparkle($80),etc...
•
•
•
•
VisualStudio(ASP.NET)
CoffeeCup ($69,FreeTrial)
Coda($99)
...
OtherHTMLEditors(notWYSIWYG)
Onlypossible tochangetheHTML
sourcecodeandthenselect“Preview”
inordertoseehowitlookslikeina
WebBrowser.
YouneedtoknowHTMLsyntax
TheWebProgrammingTriangle
HTML
UseHTML todefinethe
contentofwebpages
Web
Programming
CSS
UseCSS tospecifythelayoutofwebpages
JavaScript
UseJavaScript toprogram
thebehaviorofwebpages
CSS
Web
Server
JavaScript
MicrosoftEdge
Server-side
Client
InternetExplorer
WebArchitecture
Chrome
Opera
Firefox
WebBrowser
HTML
CSS
JavaScript
WebServer
Safari
Client
Client-ServerExample
WebBrowser
Response
WebServer
Database
Request
InternetInformation Services(IIS),Apache,etc.
WebPlatform
TheWebBrowsercreatesthevisualwebpageyouseeinthebrowserbasedon
theHTMLcode
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
HTML,CSS,JavaScript
WebBrowser
Thecoderunsontheserveranditsconverted
toHTMLbeforesending totheclient(Web
Browser)
ASP.NET,PHP,...
Client-side
WebPage(HTML)
WebServer
Server-side
InternetInformation Services(IIS),Apache,etc.
Example
HTMLWebPage
Hans-PetterHalvorsen,M.Sc.
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
HTMLCode
SimpleHTMLPage
Example
<p>My first paragraph.</p>
</body>
</html>
WebBrowser:
14
InthisExamplewewill
createasimpleHTMLpage
usingNotepadonly
Saveas.htmfileand
openfromFileExplorer
InthisExamplewewillcreateasimpleHTMLpageusingNotepadonly
ASP.NETWebApps
Hans-PetterHalvorsen,M.Sc.
Client
ASP.NET
ASP.NETisusedtocreate
dynamicwebpages
WebBrowser
HTML
JavaScript
CSS
Server-side
Theserver-side ASP.NETpagesareconvertedonthe
servertoHTMLpagesbeforeitissenttotheclient
WebServer
ASP.NET
C#/VB.NET
.NETFramework
ASP.NET– Differentwaysofcreating
WebSiteswithASP.NET
WebSites
ASP.NET
WebPages
ASP.NET
WebForms
ASP.NET
C#/VB.NET
.NETFramework
http://www.asp.net
ASP.NET
MVC
Youcanuse(atleast)3different
approacheswhencreatingWeb
SiteswithASP.NET
ASP.NET
WebPages
• SingePageModel(Theserver-sidecodeismixedinbetweenthe
HTML)
• UsestheRazorsyntax(.cshtmlfiles)
• SimiliarasClassicASPandPHP
• AtoolcalledMicrosoftWebMatrixisoptimizedforthis
developmentmodel,butyoucanalsouseVisualStudioifyou
wantto.
ASP.NET
WebForms
• SimilartothedesktopdevelopmentmodelusedinWPF
• GUI(*.aspx files)andCode(*.aspx.cs)separatedindiff.Files
• ForthosewhoarefamiliarwithWinForms,.NET,WPF,etc.
ASP.NET
MVC
• MVC– Model- View– Controller
• Anewdevelopmentmodelwhereyousplityourdevelopment
into3parts/components:ModelsforData,ViewsforDisplay
andControllersforInput.For“Advanced”Developers
ASP.NETWebForms
CreateaNewProjectinVisualStudio
Example
ASP.NETWebFormApp
Hans-PetterHalvorsen,M.Sc.
ASP.NETWebFormExample
Whenyouarefinished,yourWebAppshouldlooksomethinglikethis:
WhenyouenteryourNameintheTextBox andclicktheOKButton,theprogram
shouldrespondwithagreetings.
Title(ordinary HTMLtext,orLabel)
Label
Label
TextBox
Button
LetscreatethisExamplewithVisualStudio
WebServer
Hans-PetterHalvorsen,M.Sc.
WebServerPlatforms
PHP
(pronounced "engine x")
- Hasbecomeverypopularlately
InternetInformationServices
ASP.NET
Cross-platform:UNIX,Linux,OSX,Windows, ...
Thetermwebservercanrefertoeitherthehardware(thecomputer)orthesoftware(thecomputerapplication)that
helps todeliverwebcontentthatcanbeaccessedthroughtheInternet.
Themostcommonuseofwebserversistohostwebsites, butthereareotherusessuch asgaming,datastorageor
runningenterpriseapplications.
WebServerPopularity
http://news.netcraft.com/archives/2015/09/16/september-2015-web-server-survey.html
InternetInformationServices
(IIS)
Hans-PetterHalvorsen,M.Sc.
InternetInformationServices(IIS)
https://en.wikipedia.org/wiki/Internet_Information_Services
• WebServerfromMicrosoft
• IntegratedwithWindows
InternetInformationServices(IIS)
• IIS– InternetInformationServices
• WebServerthathosttheWebPages/Web Site
• MakesuretohavetheIISRoleinstalledwithASP.NETsub
components
DefaultIISDirectory:
C:\inetpub\wwwroot
Installation/
Configuration
Searchfor«Windows Features»oropentheControlPanel
Youneedto
turnIISon
InternetInformationServices(IIS)Manager
Deploy/PublishWebServicetoIIS
CopyWebServiceFiles(Project)todefaultIISDirectory:C:\inetpub\wwwroot
Example
DeployHTMLWebSitetoIIS
Hans-PetterHalvorsen,M.Sc.
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
IISDeployment
IISDeployment
TestyourWebPagein
yourWebbrowser
“localhost”isyourpersonal
computer, youcamalsouse
yourIPaddress.
WebServer
Clients
WebPage
Development
Tool
E.g.VisualStudio
YourDevelopment PC
PCwithWebBrowser
<!DOCTYPE html>
<html>
<body>
<h1>My First Heading</h1>
HTMLCode
SimpleHTMLPage
Example
<p>My first paragraph.</p>
</body>
</html>
WebBrowser:
40
Example
DeployASP.NETWebApptoIIS
Hans-PetterHalvorsen,M.Sc.
CreateWebAppinVisualStudio
CreateWebAppinVisualStudio
CreateandTestWebAppinVisualStudio
InternetInformationServices(IIS)Manager
1
Add yourApplication inIISManager
CopyyourVisual
Studio Project
2
3
RenameyourWebForm orAdd NewDefaultDocument
4
ThenTestyourWebApp
TestIt
NotWorking?
• Installcorrect.NETFrameworkintheVirtual
Machine
• MakesuretheIISUserhasaccess(“owner”or
“read/write”)totheSQLServerDatabase
Example
DeployASP.NETWebApps
withVisualStudio
Hans-PetterHalvorsen,M.Sc.
Deployment/Publish
Alternatives:
- Createa“InstallationPackage”thatyouortheCustomer
needtoinstallontheserver(WebDeployPackage)
- Deploydirectlytotheserverusing“WebDeploy”(You
needtohaveonlineaccesstotheserver)
- Deploydirectlytotheserverusing“FTP”(Youneedto
haveonlineaccesstotheserver)
- FileSystem
50
Deployment
Alternative#1
FileSystemDeployment
Hans-PetterHalvorsen,M.Sc.
FileSystemDeployment
Right-clickon theASP.NETProjectintheSolution
ExplorerinVisualStudio andselect“Publish...”
Copy«MyWebApp»
TotheIISFolder(inetpub/wwwroot)
InternetInformationServices(IIS)Manager
1
Add yourApplication inIISManager
CopyyourVisual
Studio Project
2
3
RenameyourWebForm orAdd
NewDefaultDocument
4
Then Testyour WebApp
TestIt!
Deployment
Alternative#2
WebPackageDeployment
Hans-PetterHalvorsen,M.Sc.
WebPackageDeployment
Right-clickon theASP.NETProjectinthe
Solution ExplorerinVisualStudio andselect
“Publish...”
Ifyoumissthe“Deploy”option,makesuretoinstallthe“Web
Deploy”features.YoumaydownloadandinstallitfromWebPI
(WebPlatformInstaller)(Googleitanddownloadit)
CreateWebPackageWizard
CreateWebPackageWizard
IfyourWebApp usesaDatabaseconnectioninWeb.config, youmaysetupthe
Connection String ontheServerhere.
YoumayfillintheConnection
String totheDatabase
Preparation
Youmayneed toinstallthe“WebDeploy”softwareontheServer
Download WebPI(WebPlatformInstaller)andthenselecttoInstall“WebDeployforHosting
Servers”
ImportPackageinIIS
ImportPackageinIIS
Makesureyouhavecopied theInstallationPackagetotheServer
WebPackageDeployment
TestIt
Hans-PetterHalvorsen,M.Sc.
UniversityCollegeofSoutheastNorway
www.usn.no
E-mail:[email protected]
Blog:http://home.hit.no/~hansha/