Home
%3CLINGO-SUB%20id%3D%22lingo-sub-952027%22%20slang%3D%22en-US%22%3ETroubleshooting%20IIS%20apps%3A%20one%20structured%20approach%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-952027%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20have%20a%20problem%20with%20our%20IIS%20application.%20Immediately%20seeing%20an%20error%20page%20with%20the%20cause%20is%20the%20lucky%20scenario.%20Sometimes%20we%20need%20to%20work%20harder%20to%20figure%20out%20what%E2%80%99s%20happening.%20Having%20a%20plan%20for%20investigation%20and%20knowing%20how%20things%20work%20together%20at%20a%20high%20level%20helps%20isolating%20where%20the%20cause%20might%20be.%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20see%20the%20big%20picture%3A%20how%20an%20HTTP%20request%20travels%20from%20the%20client%20to%20IIS%2C%20how%20the%20response%20is%20generated%2C%20and%20what%20traces%20we%20look%20at%2C%20or%20collect%2C%20for%20diagnosing.%3C%2FP%3E%0A%3CP%3EThis%20article%20also%20explains%20why%20we%20need%20to%20collect%20the%20basic%20IIS%20troubleshooting%20files%20as%20per%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fiisbasicfiles%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fiisbasicfiles%3C%2FA%3E.%20And%20what%20we%20hope%20to%20find%20there%2C%20before%20digging%20really%20deep.%3C%2FP%3E%0A%3CP%3EIn%20short%2C%20we%20look%20at%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EHTTP%20traces%20from%20client%20side%3C%2FLI%3E%0A%3CLI%3EThe%20HTTPERR%20logs%20of%20the%20HTTP.SYS%20driver%3C%2FLI%3E%0A%3CLI%3EIIS%20logs%20and%2C%20if%20collected%2C%20Failed%20Request%20Traces%2C%20aka%20FREB%20logs%3C%2FLI%3E%0A%3CLI%3EWindows%20Events%20from%20Event%20Viewer%2C%20System%20(Source%3DWAS)%20and%20Application%20logs%3C%2FLI%3E%0A%3CLI%3EUltimately%2C%20we%20collect%20memory%20dumps%20from%20IIS%20worker%20processes%2C%20w3wp.exe%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CA%20id%3D%22http-trace%22%20target%3D%22_blank%22%20name%3D%22http-trace%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1849663420%22%20id%3D%22toc-hId-1849663419%22%3EHTTP%20traces%20from%20client%20side%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--899007046%22%20id%3D%22toc-hId--899007047%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3EThe%20issue%20is%20not%20always%20obvious.%20There%20is%20no%20error%20page%20displayed%20by%20the%20browser%2C%20for%20example.%20It%20may%20be%20just%20a%20freeze%2C%20because%20AJAX%20calls%20are%20failing.%20Sometimes%20the%20client%20is%20not%20even%20a%20browser.%20Or%20the%20client%20may%20not%20event%20be%20able%20to%20contact%20the%20server%20at%20all%2C%20such%20as%20when%20the%20SChannel%20used%20by%20HTTPS%20is%20failing.%3C%2FP%3E%0A%3CP%3EMore%20often%20than%20not%2C%20we%20need%20to%20see%20what%20the%20client%20is%20sending%2C%20what%20it%20receives%20if%20anything%2C%20in%20what%20sequence%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-843803289%22%20id%3D%22toc-hId-843803288%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3EUse%20Fiddler%2C%20HTTPWatch%2C%20or%20at%20least%20the%20network%20tab%20in%20the%20browser%E2%80%99s%20developer%20tools.%20For%20the%20last%20option%2C%20don%E2%80%99t%20forget%20to%20preserve%20logs%2C%20in%20case%20requests%20are%20deleted%20from%20a%20page%20navigation%20to%20the%20next.%20Of%20course%2C%20you%20should%20be%20reproducing%20the%20issue%20while%20collecting%20the%20trace.%3C%2FP%3E%0A%3CP%3EIf%20using%20Fiddler%20for%20HTTPS%20traffic%2C%20don%E2%80%99t%20forget%20to%20decrypt%20before%20sharing%20with%20others.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1708353672%22%20id%3D%22toc-hId--1708353673%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EThe%20article%20at%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttptrace%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttptrace%3C%2FA%3E%20details%20on%20collecting%20traces.%3C%2FP%3E%0A%3CP%3EWikipedia%20documents%20well%20the%20%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FList_of_HTTP_status_codes%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHTTP%20response%20status%20codes%3C%2FA%3E%20and%20so%20does%20the%20%3CA%20href%3D%22https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTTP%2FStatus%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMozilla%20developer%20site%3C%2FA%3E%2C%20just%20in%20case%20you%20want%20to%20interpret%20these%20in%20the%20HTTP%20trace.%3C%2FP%3E%0A%3CP%3E%3CA%20id%3D%22http-sys%22%20target%3D%22_blank%22%20name%3D%22http-sys%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-230970168%22%20id%3D%22toc-hId-230970167%22%3EHTTP.SYS%20logs%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1777266998%22%20id%3D%22toc-hId-1777266997%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3EWe%20tend%20to%20forget%20there%20are%20elements%20between%20the%20client%20and%20IIS.%20The%20web%20server%20stands%20on%20top%20of%20HTTP.SYS%20driver.%20Requests%20from%20clients%20have%20to%20pass%20through%20HTTP.SYS%2C%20which%20handles%20the%20TCP%20connections%2C%20before%20actually%20getting%20to%20IIS%20web%20server.%3C%2FP%3E%0A%3CP%3EHTTP.SYS%20also%20establishes%20the%20SSL%2FTLS%20SChannel%20used%20in%20HTTPS%2C%20the%20Secure%20Channel%20tunnel%3B%20see%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttps%3C%2FA%3E.%20Request%20validation%20happens%20in%20HTTP.SYS%3B%20for%20instance%2C%20too%20large%20an%20HTTP%20request%20header%20may%20cause%20rejection.%20And%20with%20certain%20configurations%2C%20HTTP.SYS%20performs%20the%20Windows%20Authentication%20of%20HTTP%20requests%20with%20Kerberos.%20All%20these%20happen%20before%20relaying%20requests%20to%20IIS%3B%20any%20failure%20here%20would%20prevent%20an%20HTTP%20request%20to%20reach%20IIS.%3C%2FP%3E%0A%3CP%3EIf%20requests%20are%20not%20getting%20to%20IIS%2C%20a%20visit%20to%20these%20HTTP.SYS%20logs%20may%20reveal%20why.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--774889963%22%20id%3D%22toc-hId--774889964%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3EWell%2C%20this%20is%20simple.%20Simply%20go%20and%20see%20the%20logs%20at%20the%20following%20path%3A%3C%2FP%3E%0A%3CPRE%3EC%3A%5CWindows%5CSystem32%5CLogFiles%5CHTTPERR%5C%3C%2FPRE%3E%0A%3CP%3EOn%20a%20side%20note%2C%20that%20path%20can%20be%20customized%2C%20configured%20within%20the%20Registry.%20The%20following%20key%20would%20reveal%20it%3A%3C%2FP%3E%0A%3CPRE%3EHKLM%3A%5CSYSTEM%5CCurrentControlSet%5CServices%5CHTTP%5CParameters%5C%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-967920372%22%20id%3D%22toc-hId-967920371%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EThe%20reference%20from%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttpsys%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttpsys%3C%2FA%3E%20helps%20explaining%20entries%20found%20in%20HTTP.SYS%20logs.%3C%2FP%3E%0A%3CP%3EApplications%20that%20rely%20on%20the%20HTTP.SYS%2C%20like%20IIS%20itself%2C%20need%20to%20configure%20the%20driver.%20A%20few%20settings%20may%20be%20seen%20at%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttpsysconfig%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttpsysconfig%3C%2FA%3E.%20For%20example%2C%20when%20you%20set%20a%20certificate%20for%20an%20HTTPS%20binding%20in%20IIS%20Manager%2C%20that%20setting%20is%20going%20down%20to%20HTTP.SYS%2C%20because%20IIS%20itself%20does%20not%20handle%20HTTPS%3B%20it%20relies%20on%20HTTP.SYS%20for%20that.%3C%2FP%3E%0A%3CP%3ESome%20HTTP.SYS%20driver%20configuration%20can%20be%20consulted%20with%20%3CSTRONG%3E%3CEM%3Enetsh%3C%2FEM%3E%3C%2FSTRONG%3E.%20Try%20the%20following%2C%20for%20a%20starter%3A%3C%2FP%3E%0A%3CPRE%3Enetsh%20http%20show%20help%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F127817i07775575BAFBB8FF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22IIS%20sits%20on%20top%20of%20HTTP.SYS.PNG%22%20title%3D%22IIS%20sits%20on%20top%20of%20HTTP.SYS.PNG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EIIS%20sits%20on%20top%20of%20HTTP.SYS%2C%20which%20in%20turn%20relies%20on%20SChannel%20provider%20for%20HTTPS%20communication%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20id%3D%22iis-logs%22%20target%3D%22_blank%22%20name%3D%22iis-logs%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1387723084%22%20id%3D%22toc-hId--1387723085%22%3EIIS%20logs%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-158573746%22%20id%3D%22toc-hId-158573745%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3ELooking%20in%20the%20IIS%20logs%20we%20can%20confirm%20that%20requests%20%3CSTRONG%3Eare%3C%2FSTRONG%3E%20getting%20from%20clients%20to%20IIS%20in%20the%20first%20place.%20Further%20on%2C%20using%20tools%20like%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D24659%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELog%20Parser%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FLog-Parser-Studio-cd458765%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELog%20Parser%20Studio%3C%2FA%3E%20we%20can%20query%20and%20analyze%20the%20logs%20to%20keep%20track%20of%20the%20overall%20server%20health%20or%20isolate%20certain%20requests%20for%20problem%20reproducing.%20We%20can%20discover%20patterns%20or%20figures%20%E2%80%93%20such%20as%20average%20time-taken%20%E2%80%93%20that%20would%20help%20with%20further%20investigation%20steps.%3C%2FP%3E%0A%3CP%3EWe%20get%20some%20extra%20information%20here.%20From%20the%20client%20side%2C%20we%20may%20see%20the%20HTTP%20response%20status%20codes%3B%20but%20IIS%20logs%20will%20also%20show%20sub-status%20codes%20and%20Win32%20processing%20status%20-%20these%20may%20reveal%20more%20about%20what%E2%80%99s%20going%20wrong.%20Sub-status%20codes%20and%20Win32%20processing%20status%20codes%20are%20not%20sent%20to%20client.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1186222792%22%20id%3D%22toc-hId-1186222791%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3EThe%20default%20IIS%20logs%20location%20is%20like%20the%20following.%20The%20actual%20path%20can%20be%20customized%20in%20the%20IIS%20Manager%20for%20a%20site%2C%20selecting%20the%20Logging%20feature.%3C%2FP%3E%0A%3CPRE%3EC%3A%5Cinetpub%5Clogs%5CLogFiles%5CW3SVC%3CFONT%20color%3D%22%23FF6600%22%3E%3CSTRONG%3E%5BsiteID%5D%3C%2FSTRONG%3E%3C%2FFONT%3E%5C%3C%2FPRE%3E%0A%3CP%3EFind%20the%20%3CSTRONG%3E%3CEM%3ESiteID%3C%2FEM%3E%3C%2FSTRONG%3E%20selecting%20the%20%3CEM%3ESites%3C%2FEM%3E%20node%20in%20IIS%20Manager%2C%20or%20looking%20into%20the%20%3CEM%3EapplicationHost.config%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1365934169%22%20id%3D%22toc-hId--1365934170%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EThe%20reference%20of%20the%20HTTP%20response%20status%20codes%20sent%20by%20IIS%20can%20be%20found%20at%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttpresponsecodes%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttpresponsecodes%3C%2FA%3E.%20Generally%2C%20a%20response%20with%20status%20and%20sub-status%20500.0%20means%20error(s)%20in%20the%20application%20being%20executed%20by%20IIS.%3C%2FP%3E%0A%3CP%3EKeep%20in%20mind%20that%20IIS%20log%20entries%20have%20the%20time%20in%20UTC%20and%20the%20response%20%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F944884%2Fdescription-of-the-time-taken-field-in-iis-6-0-and-iis-7-0-http-loggin%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Etime-taken%3C%2FA%3E%20generally%20includes%20the%20network%20transfer%20time%3A%20from%20the%20first%20byte%20of%20the%20request%2C%20to%20the%20last%20byte%20of%20the%20response.%3C%2FP%3E%0A%3CP%3EAs%20for%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D24659%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELog%20Parser%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2FLog-Parser-Studio-cd458765%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELog%20Parser%20Studio%3C%2FA%3E%20for%20analyzing%20the%20logs%2C%20there%20are%20resources%20helping%20you%20get%20started%2C%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Flogparserplus.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ELogParserPlus.com%3C%2FA%3E%20or%20%3CA%20href%3D%22https%3A%2F%2Fblogs.iis.net%2Fcarlosag%2Fanalyze-your-iis-log-files-favorite-log-parser-queries%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%20blog%20post%3C%2FA%3E.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20id%3D%22windows-events%22%20target%3D%22_blank%22%20name%3D%22windows-events%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--2121139771%22%20id%3D%22toc-hId--2121139772%22%3EWindows%20Event%20Viewer%20entries%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-2119686501%22%20id%3D%22toc-hId-2119686500%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3EWhile%20HTTP%20traces%2C%20IIS%20logs%20and%20HTTP.SYS%20may%20show%20us%20the%20overall%20info%20about%20requests%20and%20responses%2C%20helping%20us%20isolate%2C%20we%20still%20know%20little%20about%20how%20the%20request%20processing%20went.%3C%2FP%3E%0A%3CP%3EWindows%20Event%20Viewer%20is%20the%20next%20stop%2C%20a%20reliable%20place%20where%20problems%20in%20the%20IIS%20processes%20(or%20the%20applications%20they%20execute)%20leave%20traces.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--432470460%22%20id%3D%22toc-hId--432470461%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CU%3ESystem%20log%3C%2FU%3E%3C%2FP%3E%0A%3CP%3EWAS%2C%20Windows%20Activation%20Service%2C%20is%20the%20IIS%20component%20that%20creates%20and%20monitors%20IIS%20w3wp.exe%20worker%20processes%2C%20for%20executing%20the%20apps%20in%20the%20application%20pools.%20WAS%20logs%20its%20activity%20and%20issues%20in%20the%20System%20log.%3C%2FP%3E%0A%3CP%3EFiltering%20this%20log%20with%20%3CEM%3ESource%3DWAS%3C%2FEM%3E%2C%20we%20get%20an%20overview%20about%20IIS%20application%20pool%20processes.%20Do%20they%20stop%20responding%3F%20Or%20do%20they%20crash%3F%20And%20if%20yes%20how%20often%3F%3C%2FP%3E%0A%3CP%3ENote%20that%20the%20SChannel%20provider%2C%20used%20by%20the%20HTTP.SYS%20for%20the%20HTTPS%20communication%2C%20is%20also%20reporting%20issues%20in%20this%20events%20log.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CU%3EApplication%20log%3C%2FU%3E%3C%2FP%3E%0A%3CP%3ELet%E2%80%99s%20remember%20that%20the%20w3wp.exe%20IIS%20processes%20are%20executing%20web%20applications%2C%20our%20code.%20To%20do%20that%2C%20w3wp.exe%20loads%20the%20.NET%20framework%20and%20the%20Asp.Net.%20If%20these%20processes%20or%20applications%20encounter%20problems%2C%20they%20are%20leaving%20traces%20in%20the%20Application%20log.%3C%2FP%3E%0A%3CP%3EIf%20an%20exception%20occurs%20in%20our%20application%2C%20and%20our%20code%20is%20not%20handling%20it%2C%20the%20Asp.Net%20framework%20will%20try%20its%20best%20to%20handle%20it%20for%20us.%20The%20exception%20may%20result%20in%20an%20error%20page%20shown%20to%20the%20application%E2%80%99s%20user%2C%20but%20at%20least%20the%20execution%20will%20continue%20for%20the%20other%20requests.%20Such%20events%20will%20be%20present%20in%20the%20log%20with%20something%20like%20%3CEM%3ESource%3D.NET%3C%2FEM%3E%20or%20%3CEM%3ESource%3DAsp.Net%3C%2FEM%3E.%20If%20we%E2%80%99re%20lucky%2C%20we%20get%20more%20than%20the%20exception%20code%3A%20we%20may%20get%20the%20context%20of%20the%20exception%2C%20such%20as%20the%20functions%20call%20stack%20or%20even%20better%2C%20lines%20of%20code%20that%20leaded%20to%20the%20exception.%3C%2FP%3E%0A%3CP%3EThis%20exception%20handling%20by%20Asp.Net%20avoids%20a%20w3wp.exe%20to%20crash%20with%20unhandled%20exceptions.%20But%20there%20are%20contexts%20when%20Asp.Net%20cannot%20handle%20the%20exception%2C%20nor%20did%20our%20application%E2%80%99s%20code.%20It%20becomes%20a%20second-chance%20exception.%20The%20OS%20will%20handle%20it%20its%20way%3A%20terminate%20the%20process%20to%20avoid%20any%20worse%20things%20to%20happen.%20In%20such%20rare%20instance%2C%20we%20would%20see%20a%20Windows%20event%20in%20the%20Application%20log%20with%20the%20%3CEM%3ESource%3DApplication%3C%2FEM%3E%2C%20mentioning%20the%20w3wp.exe%20as%20a%20process%2C%20with%20its%20PID%2C%20and%20the%20exception%20code.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1310339875%22%20id%3D%22toc-hId-1310339874%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EKeep%20in%20mind%20that%20some%20other%20relevant%20events%20are%20not%20collected%20by%20default.%20One%20example%3A%20CAPI%20events%2C%20Cryptographic%20API.%20The%20CAPI%20is%20used%20by%20the%20SChannel%20provider%20when%20HTTP.SYS%20establishes%20HTTPS%20communication%3B%20see%20%3CA%20href%3D%22http%3A%2F%2Flinqto.me%2Fhttps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flinqto.me%2Fhttps%3C%2FA%3E.%20So%2C%20investigating%20HTTPS%20issues%20might%20lead%20to%20%3CA%20href%3D%22https%3A%2F%2Fbenperk.github.io%2Fmsdn%2F2013%2F2013-09-enable-capi2-event-logging-to-troubleshoot-pki-and-ssl-certificate-issues.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eenabling%20CAPI%20logging%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ENote%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E%3A%20Unlike%20the%20IIS%20logs%2C%20the%20Windows%20Event%20Viewer%20is%20showing%20event%20time%20in%20local%20system%E2%80%99s%20time-zone%2C%20not%20in%20UTC.%20Only%20the%20Details%20XML%20view%20is%20showing%20the%20UTC%20timestamp.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%3CA%20id%3D%22freb%22%20target%3D%22_blank%22%20name%3D%22freb%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-555134273%22%20id%3D%22toc-hId-555134272%22%3EFREBs%2C%20Failed%20Request%20Traces%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-500993249%22%20id%3D%22toc-hId-500993248%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3EIf%20we%E2%80%99re%20still%20on%20our%20trail%20to%20hunt%20down%20the%20problem%20cause%2C%20let%E2%80%99s%20look%20inside%20IIS%2C%20how%20it%20processes%20requests%20in%20those%20w3wp.exe%20instances.%3C%2FP%3E%0A%3CP%3ETo%20generate%20a%20response%2C%20requests%20are%20processed%20in%20a%20pipeline.%20At%20each%20step%20in%20the%20pipeline%2C%20notifications%20are%20sent%20to%20various%20modules%20that%20are%20loaded%20inside%20w3wp.exe.%20The%20IIS%20native%20or%20custom%20modules%20are%20subscribing%20to%20these%20notifications%2C%20and%20they%20may%20work%20on%20the%20request%20as%20it%20travels%20through%20the%20pipeline.%3C%2FP%3E%0A%3CP%3EDepending%20on%20its%20configuration%2C%20a%20module%20may%20do%20something%20or%20nothing%20on%20the%20request%2C%20but%20it%20will%20surely%20report%20events%20or%20its%20activity.%20FREB%2C%20Failed%20Request%20Event%20Buffering%2C%20can%20capture%20these%20events%20and%20persist%20them%20in%20log%20files.%3C%2FP%3E%0A%3CP%3EThese%20logs%20show%20what%20happens%20at%20stages%20in%20pipeline%2C%20how%20long%20does%20it%20take%20for%20a%20response%20to%20be%20sent.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--2051163712%22%20id%3D%22toc-hId--2051163713%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3EThe%20Failed%20Request%20Tracing%20is%20an%20optional%20IIS%20feature.%20We%20need%20to%20make%20sure%20it%20is%20installed%2C%20to%20capture%20FREB%20logs.%3C%2FP%3E%0A%3CP%3ETo%20collect%2C%20we%20add%20rules%20telling%20in%20what%20conditions%20a%20trace%20should%20be%20taken.%20Then%20we%20enable%20tracing%20for%20a%20specific%20site.%3C%2FP%3E%0A%3CP%3EOf%20course%2C%20trace%20collection%20should%20happen%20while%20the%20problem%20is%20reproduced%2C%20to%20capture%20the%20conditions%20causing%20it.%3C%2FP%3E%0A%3CP%3EDefault%20location%20of%20FREB%20trace%20log%20files%20is%20below%3A%3C%2FP%3E%0A%3CPRE%3EC%3A%5Cinetpub%5Clogs%5CFailedReqLogFiles%5CW3SVC%3CFONT%20color%3D%22%23FF6600%22%3E%3CSTRONG%3E%5BsiteID%5D%3C%2FSTRONG%3E%3C%2FFONT%3E%5C%3C%2FPRE%3E%0A%3CP%3EFind%20the%20%3CSTRONG%3E%3CEM%3ESiteID%3C%2FEM%3E%3C%2FSTRONG%3E%20selecting%20the%20%3CEM%3ESites%3C%2FEM%3E%20node%20in%20IIS%20Manager%2C%20or%20looking%20into%20the%20%3CEM%3EapplicationHost.config%3C%2FEM%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--308353377%22%20id%3D%22toc-hId--308353378%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EKeep%20in%20mind%20that%20tracing%20does%20incur%20a%20minor%20performance%20penalty%3B%20after%20we%20collect%20data%2C%20we%20should%20disable%20it.%3C%2FP%3E%0A%3CP%3EA%20FREB%20only%20collects%20a%20(configurable)%20number%20of%20trace%20logs%2C%20and%20these%20usually%20take%20less%20than%201%20MB%20each%3B%20disk%20space%20should%20not%20be%20an%20issue.%3C%2FP%3E%0A%3CP%3EOn%20the%20IIS%20documentation%20site%20there%20are%20a%20couple%20of%20articles%20on%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fiis%2Ftroubleshoot%2Fusing-failed-request-tracing%2Ftroubleshooting-failed-requests-using-tracing-in-iis%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eusing%20FREB%20to%20troubleshoot%20issues%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EThe%20FREB%20logs%20are%20XML%20files%20that%20should%20be%20opened%20with%20Internet%20Explorer.%20Make%20sure%20that%20the%20%3CEM%3Efreb.xsl%3C%2FEM%3E%20file%20generated%20with%20the%20trace%20collection%20is%20in%20the%20same%20directory.%3C%2FP%3E%0A%3CP%3EIf%20we%20see%20a%20response%20status%20code%20of%20500.0%20or%20an%20error%20generated%20with%20the%20%3CEM%3Ehandler%3C%2FEM%3E%2C%20it%20means%20an%20exception%20in%20the%20executed%20application.%20The%20handler%20is%20the%20one%20that%20generates%20the%20response%20for%20the%20client%2C%20usually%20our%20code%20executed%20by%20IIS.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F149561i7BC84191390816D6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22FREB%2C%20pipeline%2C%20modules%2C%20notifications.PNG%22%20title%3D%22FREB%2C%20pipeline%2C%20modules%2C%20notifications.PNG%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFREB%3A%20IIS%20processing%20pipeline%2C%20notifications%20to%20modules%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CA%20id%3D%22dumps%22%20target%3D%22_blank%22%20name%3D%22dumps%22%3E%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1175719688%22%20id%3D%22toc-hId-1175719687%22%3ECollect%20and%20analyze%20memory%20dumps%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1121578664%22%20id%3D%22toc-hId-1121578663%22%3EWhy%3F%3C%2FH3%3E%0A%3CP%3EThere%20are%20cases%20when%20the%20root%20cause%20of%20the%20issue%20is%20deeply%20buried%20in%20the%20code%20executed%20by%20the%20.NET%20framework%2C%20inside%20the%20w3wp.exe.%20Threads%20executing%20our%20code%20to%20generate%20the%20responses%20encounter%20exceptions%2C%20or%20they%20get%20blocked.%20Their%20behavior%20is%20either%20caused%20by%20the%20execution%20path%2C%20by%20the%20application%E2%80%99s%20objects%20in%20memory%2C%20or%20by%20certain%20conditions.%20Suffice%20to%20say%20that%20there%20are%20cases%20when%20we%20need%20to%20look%20deep%20into%20the%20process%20memory%20for%20loaded%20modules%2C%20call%20stacks%2C%20objects%20etc.%20We%20need%20memory%20dumps%20for%20post-mortem%20analysis.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1430578297%22%20id%3D%22toc-hId--1430578298%22%3EHow%3F%3C%2FH3%3E%0A%3CP%3EDump%20analysis%20for%20debugging%20is%20expensive%20%E2%80%93%20it%20requires%20expertise%20to%20do%20the%20debugging.%20In%20addition%2C%20the%20dump%20collection%20itself%20needs%20to%20be%20carefully%20planned%2C%20otherwise%20the%20collected%20dump(s)%20may%20not%20capture%20the%20exact%20context%20with%20the%20root%20cause.%3C%2FP%3E%0A%3CP%3EFirst%20of%20all%2C%20capture%20a%20FULL%20memory%20dump.%20We%20need%20to%20have%20access%20to%20all%20the%20committed%20memory%20of%20the%20process%20to%20see%20the%20objects.%3C%2FP%3E%0A%3CP%3ESecondly%2C%20capture%20several%20dumps%2C%20not%20just%20one.%20It%20is%20always%20better%20to%20have%20too%20much%20data%20and%20discard%20than%20having%20insufficient%20data.%3C%2FP%3E%0A%3CP%3EThe%20process%20dump%20is%20like%20a%20photo%2C%20a%20snapshot%20of%20the%20memory.%20A%20dump%20collected%20a%20split%20second%20too%20late%20will%20show%20call%20stacks%20that%20are%20not%20capturing%20the%20exception%20context.%20Or%20maybe%20objects%20are%20no%20longer%20in%20the%20memory%20due%20to%20garbage%20collection.%3C%2FP%3E%0A%3CP%3EA%20single%20dump%20can%20only%20show%20one%20point%20in%20time.%20A%20series%20of%20dumps%20from%20the%20same%20process%20instance%20%E2%80%93%20same%20PID%2C%20process%20ID%20%E2%80%93%20can%20show%20trends%3A%20how%20things%20are%20unfolding%2C%20if%20threads%20remain%20blocked%2C%20how%20memory%20heaps%20are%20evolving%20etc.%3C%2FP%3E%0A%3CP%3ETake%20at%20least%203%20to%205%20dumps%3B%20the%20more%2C%20the%20better.%20But%20if%20it%E2%80%99s%20not%20from%20the%20same%20PID%2C%20remember%20that%20new%20PID%20means%20a%20totally%20new%20memory%20space%3B%20all%20objects%20and%20threads%20are%20lost%20with%20a%20killed%20process.%3C%2FP%3E%0A%3CP%3EAllow%205%20to%2010%20seconds%20between%20consecutive%20dumps%2C%20if%20we%E2%80%99re%20studying%20performance%20issued.%20Allow%20the%20committed%20memory%20to%20grow%20between%20dumps%20if%20we%E2%80%99re%20studying%20memory%20leaks.%20Some%20300%20MB%2C%20500%20MB%20or%201%20GB%20%E2%80%93%20whatever%20is%20relevant%20as%20growth%20for%20a%20certain%20period.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CU%3ETooling%20for%20dump%20collection%3C%2FU%3E%3C%2FP%3E%0A%3CP%3ENow%2C%20you%20cannot%20stay%20and%20watch%20over%20the%20w3wp.exe%20to%20see%20when%20the%20exception%20occurs.%20And%20performance%20issues%20are%20not%20always%20easily%20reproducible%2C%20or%20we%20can%E2%80%99t%20be%20around%20to%20witness.%20So%2C%20we%20rely%20on%20automated%20tools%20that%20are%20attaching%20to%20w3wp.exe%20process%20instances%20and%20are%20monitoring%20those%20for%20the%20occurrences%20of%20the%20investigated%20issue.%20When%20it%20happens%2C%20the%20dump%20is%20collected%20and%20saved%20to%20disk.%3C%2FP%3E%0A%3CP%3EOne%20such%20tool%20is%20called%20%3CSTRONG%3EDebug%20Diagnostics%3C%2FSTRONG%3E.%20We%20need%20to%20download%20Debug%20Diagnostic%20and%20install%20at%20least%20the%20dump%20collection%20component%20on%20the%20IIS%20machine.%20DebugDiag%20has%20intuitive%20UI%20and%20can%20monitor%20all%20w3wp.exe%20processes%20created%20for%20a%20specific%20application%20pool%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D49924%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D49924%3C%2FA%3E%20v2.2%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D58210%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-us%2Fdownload%2Fdetails.aspx%3Fid%3D58210%3C%2FA%3E%20v2.3%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20other%20tool%20is%20%3CSTRONG%3EProcDump%3C%2FSTRONG%3E%2C%20having%20similar%20capabilities%20as%20DebugDiag%2C%20but%20requiring%20no%20installation.%20It%20is%20a%20command-line%20tool%2C%20so%20it%20can%20be%20used%20in%20environments%20with%20no%20UI%2C%20such%20as%20Windows%20Server%20Core%20installations%20or%20Azure%20App%20Services.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsysinternals%2Fdownloads%2Fprocdump%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsysinternals%2Fdownloads%2Fprocdump%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%3CBR%20%2F%3E%3C%2FSTRONG%3E%3CU%3ETooling%20for%20dump%20analysis%3C%2FU%3E%3C%2FP%3E%0A%3CP%3EThe%20%3CSTRONG%3EDebug%20Diagnostics%3C%2FSTRONG%3E%20mentioned%20above%20has%20an%20Analysis%20component.%20It%20allows%20for%20automated%20analysis%20on%20collected%20dumps%2C%20which%20may%20reveal%20a%20host%20of%20common%20issues%20usually%20found%20in%20IIS%20and%20other%20types%20of%20processes.%20And%20even%20with%20less%20common%20issues%2C%20it%20may%20show%20valuable%20hints%20on%20what%20is%20causing%20the%20problem%2C%20such%20as%20threads%20stuck%20waiting%20on%20database%20or%20network%20calls.%3C%2FP%3E%0A%3CP%3EWhen%20the%20automated%20analysis%20performed%20by%20DebugDiag%20is%20not%20enough%2C%20we%20must%20switch%20to%20%E2%80%9Cmanual%E2%80%9D%20analysis.%20This%20is%20performed%20with%20%3CSTRONG%3EWinDbg%3C%2FSTRONG%3E.%20But%20using%20it%20requires%20some%20experience%2C%20knowledge%20on%20inner%20workings%20of%20a%20process%20and%20memory%2C%20and%20spending%20some%20time%20accommodating%20with%20the%20debugger%20commands.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fdebugger%2Fdebugger-download-tools%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-hardware%2Fdrivers%2Fdebugger%2Fdebugger-download-tools%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-312232038%22%20id%3D%22toc-hId-312232037%22%3EMore%3A%3C%2FH3%3E%0A%3CP%3EAll%20the%20tools%20mentioned%20here%20are%20free%20from%20Microsoft%2C%20well%20documented.%20And%20they%20have%20been%20around%20for%20quite%20some%20time%2C%20so%20we%20can%20find%20a%20lot%20of%20additional%20resources%20on%20the%20internet%20on%20how%20to%20use%20them%2C%20including%20on%20this%20blog.%20For%20instance%2C%20for%20setting%20up%20DebugDiag%20Collection%20with%20rules%20on%20taking%20dumps...%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EWhen%20exceptions%20are%20thrown%20by%20execution%20threads%20in%20a%20process%3B%3C%2FLI%3E%0A%3CLI%3EFor%20crashing%2C%20or%20when%20the%20worker%20process%20is%20forcibly%20shut-down%3B%3C%2FLI%3E%0A%3CLI%3EFor%20performance%20issues%2C%20when%20requests%20are%20being%20served%20too%20slow%2C%20or%20too%20much%20CPU%20is%20being%20used%3B%3C%2FLI%3E%0A%3CLI%3ETo%20detect%20memory%20leaks%2C%20when%20the%20process%20is%20consuming%20increasingly%20more%20memory.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EBoth%20DebugDiag%20Collection%20and%20ProcDump%20act%20like%20debuggers.%20They%20attach%20to%20a%20process%20and%20it%20monitor%20it.%20Under%20certain%20configurable%20conditions%2C%20a%20memory%20dump%20of%20the%20process%20is...%20dumped%20on%20the%20disk.%3C%2FP%3E%0A%3CP%3EA%20debugger%20takes%20precedence%20and%20is%20notified%20with%20all%20exception%20triggered%20by%20a%20process%20code%2C%20handled%20or%20not.%20Well%2C%20an%20unhandled%20exception%20becomes%20a%20second-chance%20one%2C%20causing%20process%20to%20crash%20(to%20be%20terminated%20by%20the%20OS).%20While%20attached%20to%20a%20process%2C%20DebugDiag%20and%20ProcDump%20will%20log%20all%20exceptions%20from%20that%20process%20and%20%3CEM%3Ecould%3C%2FEM%3E%20also%20take%20memory%20dumps.%20The%20exception%20logs%20may%20be%20useful%20for%20the%20developers%20or%20sysadmins%2C%20that%20could%20take%20measures%20to%20fix%20or%20avoid.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--442973564%22%20id%3D%22toc-hId--442973565%22%3EFinally%3C%2FH2%3E%0A%3CP%3EThe%20above%20diagnosing%20data%20collection%20process%20does%20not%20cover%20all%20scenarios.%20Sometimes%20performance%20monitoring%20is%20used%2C%20or%20perhaps%20.NET%20execution%20tracing%20is%20a%20better%20option.%20The%20investigation%20can%20take%20on%20other%20roads...%3C%2FP%3E%0A%3CP%3EHowever%2C%20the%20steps%20here%20cover%20a%20large%20range%20of%20issue%20investigations%3B%20they%20constitute%20a%20pattern%20that%20applies%20in%20many%20of%20the%20cases.%3C%2FP%3E%0A%3CP%3EAll%20the%20best%20of%20luck!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-952027%22%20slang%3D%22en-US%22%3E%3CP%3ELet%E2%80%99s%20see%20the%20big%20picture%3A%20how%20an%20HTTP%20request%20travels%20from%20the%20client%20to%20IIS%2C%20how%20the%20response%20is%20generated%2C%20and%20what%20traces%20we%20look%20at%2C%20or%20collect%2C%20for%20diagnosing.%3C%2FP%3E%3C%2FLINGO-TEASER%3E

We have a problem with our IIS application. Immediately seeing an error page with the cause is the lucky scenario. Sometimes we need to work harder to figure out what’s happening. Having a plan for investigation and knowing how things work together at a high level helps isolating where the cause might be.

Let’s see the big picture: how an HTTP request travels from the client to IIS, how the response is generated, and what traces we look at, or collect, for diagnosing.

This article also explains why we need to collect the basic IIS troubleshooting files as per http://linqto.me/iisbasicfiles. And what we hope to find there, before digging really deep.

In short, we look at:

  1. HTTP traces from client side
  2. The HTTPERR logs of the HTTP.SYS driver
  3. IIS logs and, if collected, Failed Request Traces, aka FREB logs
  4. Windows Events from Event Viewer, System (Source=WAS) and Application logs
  5. Ultimately, we collect memory dumps from IIS worker processes, w3wp.exe

 

 

 

HTTP traces from client side

 

Why?

The issue is not always obvious. There is no error page displayed by the browser, for example. It may be just a freeze, because AJAX calls are failing. Sometimes the client is not even a browser. Or the client may not event be able to contact the server at all, such as when the SChannel used by HTTPS is failing.

More often than not, we need to see what the client is sending, what it receives if anything, in what sequence etc.

 

How?

Use Fiddler, HTTPWatch, or at least the network tab in the browser’s developer tools. For the last option, don’t forget to preserve logs, in case requests are deleted from a page navigation to the next. Of course, you should be reproducing the issue while collecting the trace.

If using Fiddler for HTTPS traffic, don’t forget to decrypt before sharing with others.

 

More:

The article at http://linqto.me/httptrace details on collecting traces.

Wikipedia documents well the HTTP response status codes and so does the Mozilla developer site, just in case you want to interpret these in the HTTP trace.

 

 

 

HTTP.SYS logs

 

Why?

We tend to forget there are elements between the client and IIS. The web server stands on top of HTTP.SYS driver. Requests from clients have to pass through HTTP.SYS, which handles the TCP connections, before actually getting to IIS web server.

HTTP.SYS also establishes the SSL/TLS SChannel used in HTTPS, the Secure Channel tunnel; see http://linqto.me/https. Request validation happens in HTTP.SYS; for instance, too large an HTTP request header may cause rejection. And with certain configurations, HTTP.SYS performs the Windows Authentication of HTTP requests with Kerberos. All these happen before relaying requests to IIS; any failure here would prevent an HTTP request to reach IIS.

If requests are not getting to IIS, a visit to these HTTP.SYS logs may reveal why.

 

How?

Well, this is simple. Simply go and see the logs at the following path:

C:\Windows\System32\LogFiles\HTTPERR\

On a side note, that path can be customized, configured within the Registry. The following key would reveal it:

HKLM:\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\

 

More:

The reference from http://linqto.me/httpsys helps explaining entries found in HTTP.SYS logs.

Applications that rely on the HTTP.SYS, like IIS itself, need to configure the driver. A few settings may be seen at http://linqto.me/httpsysconfig. For example, when you set a certificate for an HTTPS binding in IIS Manager, that setting is going down to HTTP.SYS, because IIS itself does not handle HTTPS; it relies on HTTP.SYS for that.

Some HTTP.SYS driver configuration can be consulted with netsh. Try the following, for a starter:

netsh http show help

 

IIS sits on top of HTTP.SYS.PNGIIS sits on top of HTTP.SYS, which in turn relies on SChannel provider for HTTPS communication

 

 

 

IIS logs

 

Why?

Looking in the IIS logs we can confirm that requests are getting from clients to IIS in the first place. Further on, using tools like Log Parser and Log Parser Studio we can query and analyze the logs to keep track of the overall server health or isolate certain requests for problem reproducing. We can discover patterns or figures – such as average time-taken – that would help with further investigation steps.

We get some extra information here. From the client side, we may see the HTTP response status codes; but IIS logs will also show sub-status codes and Win32 processing status - these may reveal more about what’s going wrong. Sub-status codes and Win32 processing status codes are not sent to client.

 

How?

The default IIS logs location is like the following. The actual path can be customized in the IIS Manager for a site, selecting the Logging feature.

C:\inetpub\logs\LogFiles\W3SVC[siteID]\

Find the SiteID selecting the Sites node in IIS Manager, or looking into the applicationHost.config.

 

More:

The reference of the HTTP response status codes sent by IIS can be found at http://linqto.me/httpresponsecodes. Generally, a response with status and sub-status 500.0 means error(s) in the application being executed by IIS.

Keep in mind that IIS log entries have the time in UTC and the response time-taken generally includes the network transfer time: from the first byte of the request, to the last byte of the response.

As for using the Log Parser and Log Parser Studio for analyzing the logs, there are resources helping you get started, such as LogParserPlus.com or this blog post

 

 

 

Windows Event Viewer entries

 

Why?

While HTTP traces, IIS logs and HTTP.SYS may show us the overall info about requests and responses, helping us isolate, we still know little about how the request processing went.

Windows Event Viewer is the next stop, a reliable place where problems in the IIS processes (or the applications they execute) leave traces.

 

How?


System log

WAS, Windows Activation Service, is the IIS component that creates and monitors IIS w3wp.exe worker processes, for executing the apps in the application pools. WAS logs its activity and issues in the System log.

Filtering this log with Source=WAS, we get an overview about IIS application pool processes. Do they stop responding? Or do they crash? And if yes how often?

Note that the SChannel provider, used by the HTTP.SYS for the HTTPS communication, is also reporting issues in this events log.


Application log

Let’s remember that the w3wp.exe IIS processes are executing web applications, our code. To do that, w3wp.exe loads the .NET framework and the Asp.Net. If these processes or applications encounter problems, they are leaving traces in the Application log.

If an exception occurs in our application, and our code is not handling it, the Asp.Net framework will try its best to handle it for us. The exception may result in an error page shown to the application’s user, but at least the execution will continue for the other requests. Such events will be present in the log with something like Source=.NET or Source=Asp.Net. If we’re lucky, we get more than the exception code: we may get the context of the exception, such as the functions call stack or even better, lines of code that leaded to the exception.

This exception handling by Asp.Net avoids a w3wp.exe to crash with unhandled exceptions. But there are contexts when Asp.Net cannot handle the exception, nor did our application’s code. It becomes a second-chance exception. The OS will handle it its way: terminate the process to avoid any worse things to happen. In such rare instance, we would see a Windows event in the Application log with the Source=Application, mentioning the w3wp.exe as a process, with its PID, and the exception code.

 

More:

Keep in mind that some other relevant events are not collected by default. One example: CAPI events, Cryptographic API. The CAPI is used by the SChannel provider when HTTP.SYS establishes HTTPS communication; see http://linqto.me/https. So, investigating HTTPS issues might lead to enabling CAPI logging.

 

Note: Unlike the IIS logs, the Windows Event Viewer is showing event time in local system’s time-zone, not in UTC. Only the Details XML view is showing the UTC timestamp.

 

 

 

FREBs, Failed Request Traces

 

Why?

If we’re still on our trail to hunt down the problem cause, let’s look inside IIS, how it processes requests in those w3wp.exe instances.

To generate a response, requests are processed in a pipeline. At each step in the pipeline, notifications are sent to various modules that are loaded inside w3wp.exe. The IIS native or custom modules are subscribing to these notifications, and they may work on the request as it travels through the pipeline.

Depending on its configuration, a module may do something or nothing on the request, but it will surely report events or its activity. FREB, Failed Request Event Buffering, can capture these events and persist them in log files.

These logs show what happens at stages in pipeline, how long does it take for a response to be sent.

 

How?

The Failed Request Tracing is an optional IIS feature. We need to make sure it is installed, to capture FREB logs.

To collect, we add rules telling in what conditions a trace should be taken. Then we enable tracing for a specific site.

Of course, trace collection should happen while the problem is reproduced, to capture the conditions causing it.

Default location of FREB trace log files is below:

C:\inetpub\logs\FailedReqLogFiles\W3SVC[siteID]\

Find the SiteID selecting the Sites node in IIS Manager, or looking into the applicationHost.config.

 

More:

Keep in mind that tracing does incur a minor performance penalty; after we collect data, we should disable it.

A FREB only collects a (configurable) number of trace logs, and these usually take less than 1 MB each; disk space should not be an issue.

On the IIS documentation site there are a couple of articles on using FREB to troubleshoot issues.

The FREB logs are XML files that should be opened with Internet Explorer. Make sure that the freb.xsl file generated with the trace collection is in the same directory.

If we see a response status code of 500.0 or an error generated with the handler, it means an exception in the executed application. The handler is the one that generates the response for the client, usually our code executed by IIS.

 

FREB, pipeline, modules, notifications.PNGFREB: IIS processing pipeline, notifications to modules

 

 

 

Collect and analyze memory dumps

 

Why?

There are cases when the root cause of the issue is deeply buried in the code executed by the .NET framework, inside the w3wp.exe. Threads executing our code to generate the responses encounter exceptions, or they get blocked. Their behavior is either caused by the execution path, by the application’s objects in memory, or by certain conditions. Suffice to say that there are cases when we need to look deep into the process memory for loaded modules, call stacks, objects etc. We need memory dumps for post-mortem analysis.

 

How?

Dump analysis for debugging is expensive – it requires expertise to do the debugging. In addition, the dump collection itself needs to be carefully planned, otherwise the collected dump(s) may not capture the exact context with the root cause.

First of all, capture a FULL memory dump. We need to have access to all the committed memory of the process to see the objects.

Secondly, capture several dumps, not just one. It is always better to have too much data and discard than having insufficient data.

The process dump is like a photo, a snapshot of the memory. A dump collected a split second too late will show call stacks that are not capturing the exception context. Or maybe objects are no longer in the memory due to garbage collection.

A single dump can only show one point in time. A series of dumps from the same process instance – same PID, process ID – can show trends: how things are unfolding, if threads remain blocked, how memory heaps are evolving etc.

Take at least 3 to 5 dumps; the more, the better. But if it’s not from the same PID, remember that new PID means a totally new memory space; all objects and threads are lost with a killed process.

Allow 5 to 10 seconds between consecutive dumps, if we’re studying performance issued. Allow the committed memory to grow between dumps if we’re studying memory leaks. Some 300 MB, 500 MB or 1 GB – whatever is relevant as growth for a certain period.


Tooling for dump collection

Now, you cannot stay and watch over the w3wp.exe to see when the exception occurs. And performance issues are not always easily reproducible, or we can’t be around to witness. So, we rely on automated tools that are attaching to w3wp.exe process instances and are monitoring those for the occurrences of the investigated issue. When it happens, the dump is collected and saved to disk.

One such tool is called Debug Diagnostics. We need to download Debug Diagnostic and install at least the dump collection component on the IIS machine. DebugDiag has intuitive UI and can monitor all w3wp.exe processes created for a specific application pool:

The other tool is ProcDump, having similar capabilities as DebugDiag, but requiring no installation. It is a command-line tool, so it can be used in environments with no UI, such as Windows Server Core installations or Azure App Services.


Tooling for dump analysis

The Debug Diagnostics mentioned above has an Analysis component. It allows for automated analysis on collected dumps, which may reveal a host of common issues usually found in IIS and other types of processes. And even with less common issues, it may show valuable hints on what is causing the problem, such as threads stuck waiting on database or network calls.

When the automated analysis performed by DebugDiag is not enough, we must switch to “manual” analysis. This is performed with WinDbg. But using it requires some experience, knowledge on inner workings of a process and memory, and spending some time accommodating with the debugger commands.

 

More:

All the tools mentioned here are free from Microsoft, well documented. And they have been around for quite some time, so we can find a lot of additional resources on the internet on how to use them, including on this blog. For instance, for setting up DebugDiag Collection with rules on taking dumps...

  • When exceptions are thrown by execution threads in a process;
  • For crashing, or when the worker process is forcibly shut-down;
  • For performance issues, when requests are being served too slow, or too much CPU is being used;
  • To detect memory leaks, when the process is consuming increasingly more memory.

Both DebugDiag Collection and ProcDump act like debuggers. They attach to a process and it monitor it. Under certain configurable conditions, a memory dump of the process is... dumped on the disk.

A debugger takes precedence and is notified with all exception triggered by a process code, handled or not. Well, an unhandled exception becomes a second-chance one, causing process to crash (to be terminated by the OS). While attached to a process, DebugDiag and ProcDump will log all exceptions from that process and could also take memory dumps. The exception logs may be useful for the developers or sysadmins, that could take measures to fix or avoid.

 
 

Finally

The above diagnosing data collection process does not cover all scenarios. Sometimes performance monitoring is used, or perhaps .NET execution tracing is a better option. The investigation can take on other roads...

However, the steps here cover a large range of issue investigations; they constitute a pattern that applies in many of the cases.

All the best of luck!