Simplify your enterprise by standardizing on the IIS application server for both Web & Windows Services. Learn more about the IIS hosting model & how to take advantage of the new Always-On service capabilities.
Given at JAXDUG on 10/5/2011.
http://www.jaxdug.com/
Scaling API-first â The story of a global engineering organization
Â
IIS Always-On Services
1. Hosting Windows Services in IIS Take advantage of the IIS platform for hosting your Always-On services. Brian Ritchie Chief ArchitectPayformance Corporation Email: brian.ritchie@gmail.com Blog: http://weblog.asp.net/britchie Web: http://www.dotnetpowered.com
2. Who am I? Brian Ritchie Chief Architect at Payformance Corporation Nearly 20 years of development experience Developing on .NET since 1.0 Beta 1 Contributed to Mono and other open source projects
3. Why build Windows Services? When you need always-on functionality Examples: File Watching & Processing Scheduled tasks Long-running tasks Queued processing
4. Why build Windows Services? Windows Services have been around forever, why change now?
6. Reasons for change Windows Services have no User Interface making them hard to monitor, manage, and debug. Windows Services are harder to deploy & canât use Web Deploy.
7. Who can save us from these problems? Iâm IIS & Iâm here to help!
8. Did you say IIS? More than just a web server, IIS is an application server platform. Web Applications: ASP.NET, PHP, and more Web Services: ASMX, WCF Multiple Protocols: HTTP, HTTPS, TCP, Named Pipes And now⊠Always-On Services: Auto-start & Always Running
11. Monitoring via the IIS Manager Since all services will be hosted under the w3wp.exe process name, you can see the Worker Process associated with your application pool within the IIS manager:
12. Monitoring via Process Explorer Another approach is to use the SysInternals Process Explorer free from Microsoft. Add the âCommand Lineâ column to the grid, and the application pool name will be listed after the âap switch.
13. DeploymentsâŠmade easy Web Deploy 2.1 Deploy Package Build/Deploy Server Build Server (using MSBuild) Deployment Package IIS Server IIS MMC â Export Application IIS MMC â Import Application
14. Look MomâŠI have a UI now! No longer âinvisibleâ, your service can publish its own monitoring & management capability
16. Getting Started First offâŠInstall the pre-reqs: IIS 7.5 (Windows 2008 R2 or Windows 7) Windows Server AppFabric .NET Framework 4.0 NextâŠConfigure IIS: Set Application Pool to âAlways Runningâ Configure Site with Net.Pipe Binding Set Application to âAuto Startâ
19. Building a service What are some fundamental differences between a standard Web Service and a Windows Service? Request-Response vs. Event-based State-less vs. State-full Transparent threading vs. Thread Management DLL vs. EXE All of the Above
21. Building a Service:Differences in Process Models Windows Service Process Model IIS Worker Process Model Service Controller Service (EXE) MMC W3WP WWW Publishing Service svchost.exe -k iissvcs AppDomain Service (DLL) IIS Manager AppDomain
22. Building a service Where does the service perform itâs startup? Application_Startin Global.asax AppInitialize in AppStart.cs AppStartup in the session controller
23. Building a service What is the scope of a static variables? Class Thread AppDomain Process Machine
24. Visualizing the stack Machine Process AppDomain Your service runs here Thread Thread Static Scope Either you manage threads directly or use a Thread Pool or TPL