140 likes | 335 Views
Configuring Applications MacDonald Ch. 9. MIS 424 Professor Sandvig. Today. Why Applications? IIS Role in handing a request .NET Applications Application Object Global.asax Configuration files Machine.config Web.Config. Why Applications?. Dark ages (pre-2003)
E N D
Configuring ApplicationsMacDonald Ch. 9 MIS 424 Professor Sandvig
Today • Why Applications? • IIS • Role in handing a request • .NET • Applications • Application Object • Global.asax • Configuration files • Machine.config • Web.Config
Why Applications? • Dark ages (pre-2003) • “blue screen of death” not unusual • Single failure bring down whole system • Worse yet: • Memory leaks • Cause IIS hang • Stop serving pages • Required manual intervention(reboot)
Why Applications • Today (Windows Server 2003 & later) • Applications still crash • Applications are compartmentalized • OS handles gracefully • System rarely affected • OS monitors application health • Recycles unhealthy processes • Result: system stable & reliable
IIS Overview • IIS listens for web requests • Default port 80 • Attempts to retrieve file • Checks permissions • Passes control to appropriate program depending upon file extension • Table lookup • ASP.NET files passed to appropriate application
IIS Overview http://theserverside.net/articles/showarticle.tss?id=IIS_ASP
IIS Applications • Folders may be configured as “Applications” • IIS provides configuration interface • Each application is assigned to an Application Pool • Each application pool has a unique Windows process • Specify error handling, timeouts, etc. for each application • Benefit: • Compartmentalize applications • Reduces dependencies • Improves reliability • Allows application specific settings • Error handling, log files, filters, headers, timeouts… • 100’s of settings
Applications Settings • Configuration settings: • Web.config • Application level settings • Located in root folder • Machine.config • Settings common to all applications • Application event handlers • Global.asax file • Located in root folder
ASP.NET Configuration .config files • Hierarchical configuration • Similar to CSS • Inheritance • Child has precedence over parent • Machine.config • Rarely need to modify
Web.Config • XML file • Case sensitive • Camel casing • Configure: • Application settings • Error handling • Timeouts • Sessions…etc. etc. • Security • .config files not served
Global.asax • Handles application & session events • 15+ events • Application_start • Application_error • Session_start • Located in root folder of application • Triggered each page request • Optional
Global.asax • Example: • Create new application on server • web.config: source • global.asax: source • TestPage.aspx: source, output
Documentation • MSDN • ASP.NET Configuration • QuickStart Samples • Configuration • Various ASP.NET sites • 4GuysFromRolla
Summary • Configuration Objectives: • Flexibility • Security • Reliability • Convenience • IIS • Handles requests • Application • Application object • Events: global.asax • Configuration • Machine.config • Web.config