IIS7.5 migration-HTTP error 404.0-not found-0x80070002 error analysis and resolution process

Source: Internet
Author: User
Tags httpcontext log4net

When an ASP. NET application migrates to IIS7.5, the site reports an HTTP error 404.0-not Found error. The process is as follows:
Operating environment: Framework 2.0,iis7.5,web Site set, no source code, application Chime think of Classic mode.
The URL of the error page is as follows: Http://localhost/HL2008/UI/AutoMonitor/135?autorun=true
See this URL address, the first reaction is HttpModule was rewritten, through the. NET Reflector 7.0 anti-compilation HL2008.Web.Common.dll, found Urlrewriter class, Implements the System.Web.IHttpModule interface.
Continue tracking, the core code of this class is a jump operation.

void Context_beginrequest (object sender, EventArgs e) {//string path = string.            Format ("~/action/requesthandler.aspx?id={0}&{1}", "Yeyang", HTTPCONTEXT.CURRENT.REQUEST.RAWURL);            HttpContext.Current.RewritePath (Path,false); ILog log = log4net. Logmanager.getlogger (Methodbase.getcurrentmethod ().            DeclaringType); Log.            Info ("Demohttpmodule context_beginrequest is called"); String p = string.            Empty; if (Globaldefine.isautomon (out P)) if (Isautomon (out p)) {log.                Info ("demohttpmodule Context_beginrequest-globaldefine.isautomon = = True is called"); String path = string.                Format ("~/ui/automonitor/automonitorbasepage.aspx?id={0}&{1}", p, HttpContext.Current.Request.QueryString);            HttpContext.Current.RewritePath (path, false); } else {log.    Info ("demohttpmodule Context_beginrequest-globaldefine.isautomon = = False is called");        }} public static bool Isautomon (out string permissionid) {PermissionID = Getpermissio            NId (); Return!string.        IsNullOrEmpty (PermissionID);        } public static string Getpermissionid () {return Getpermissionid (HTTPCONTEXT.CURRENT.REQUEST.RAWURL); The public static string Getpermissionid (string url) {ILog log = log4net. Logmanager.getlogger (Methodbase.getcurrentmethod ().            DeclaringType); Log.            Info ("Demohttpmodule Getpermissionid is called"); Log. Info (String.            Format ("URL address is [{0}]", url)); String PermissionID = String.            Empty; MatchCollection mc = new Regex (@ "\/ui\/automonitor\/(?<permissionid> (\d+)) (($) | ( \?\s+)) ", regexoptions.ignorecase).            Matches (URL); if (MC. Count > 0) {return mc[0]. groups["PermissionID"].            Value; } log. Info ("After the first regular match: MC.            Count = = 0 "); MC = new Regex (@ "/ui/automonitor/automonitorbasepage.aspx\?id= (? <permissionid>\d+) ", regexoptions.ignorecase).            Matches (URL); if (MC. Count > 0) {permissionid = mc[0]. groups["PermissionID"].            Value;        } return PermissionID; }

Therefore initially decided that HttpModule was not activated, through web search, to find a similar blog post (http://q.cnblogs.com/q/38592/), which mentions IIS7.5 under the httpmodules use appears: 404 To Solve, The modules configuration needs to be added to the <system.webServer> configuration section.
in the Web. config at this time, there are httpmodules and httphandlers configured under <system.web>,<system.webserver> The modules and handlers configurations are available.
The problem is still unresolved, and the application is not activated http://localhost/HL2008/UI/AutoMonitor/135 by inserting the modules component of the Log4net log into the output log in the original application? Autorun=true the request had been terminated before. The log is as follows:

 -Demohttpmodule Context_beginrequest is called 2015-01-12 12:41:37,010 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) ;  -Demohttpmodule Getpermissionid is called 2015-01-12 12:41:37,010 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) >-URL Address is [/hl2008/ui/security/main.aspx/focushashcode]2015-01-12 12:41:37,010 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-12 12:41:37,010 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginr Equest-globaldefine.isautomon = = False is called 2015-01-12 12:42:01,313 [1276] INFO demo.demohttpmodule [(NULL)] < (NULL) &G T -Demohttpmodule Context_beginrequest is called 2015-01-12 12:42:01,313 [1276] INFO demo.demohttpmodule [(NULL)] < (NULL)  >-Demohttpmodule Getpermissionid is called 2015-01-12 12:42:01,313 [1276] INFO demo.demohttpmodule [(NULL)] < (NULL) > -The URL address is [/hl2008/ui/security/main.aspx/focushashcode]2015-01-12 12:42:01,313 [1276] INFO demo.demohttpmodule [(NULL) ] <(null) >-After the first regular match: MC. Count = = 02015-01-12 12:42:01,313 [1276] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginr Equest-globaldefine.isautomon = = False is called 2015-01-12 12:42:06,804 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) &G T -Demohttpmodule Context_beginrequest is called 2015-01-12 12:42:06,804 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL)  >-Demohttpmodule Getpermissionid is called 2015-01-12 12:42:06,804 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) > -The URL address is [/hl2008/ui/security/main.aspx/focushashcode]2015-01-12 12:42:06,804 [4084] INFO demo.demohttpmodule [(NULL) ] < (NULL) >-After the first regular match: MC. Count = = 02015-01-12 12:42:06,804 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginr Equest-globaldefine.isautomon = = False is called 2015-01-12 12:42:11,921 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) &G T -Demohttpmodule Context_beginrequest is called 2015-01-12 12:42:11,921 [4084] INFO demo.demohttpModule [(NULL)] < (NULL) >-Demohttpmodule Getpermissionid is called 2015-01-12 12:42:11,921 [4084] INFO Demo.demohttpmodu  Le [(NULL)] < (NULL) >-the URL address is [/hl2008/ui/security/main.aspx/focushashcode]2015-01-12 12:42:11,921 [4084] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-12 12:42:11,921 [4084] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginr Equest-globaldefine.isautomon = = False is called

The problem is defined as modules was called, but the request was not activated http://localhost/HL2008/UI/AutoMonitor/135?autorun=true.
continue, setting the application pool to Integrated mode, IIS errors are as follows:
HTTP error 500.22-internal Server error
detected an ASP. NET setting that is not applicable in integrated managed pipeline mode.
Module: configurationvalidationmodule
Notification: beginrequest
Handler: Staticfile
Error code: 0x80070032
Key information is as follows:
Most likely cause: This application defines the configuration in the System.web/httpmodules section. The
then rejects the System.web/httpmodules configuration section
to initiate the request, continuing with the HTTP error, with the following key information:
? This application defines the configuration in the System.web/httphandlers section. The
rejects the System.web/httphandlers configuration section. The
initiates the request. The contents of the log are as follows:

2015-01-12 22:03:18,058 [6676] INFO  demo.demohttpmodule [(NULL)] < (NULL) >-demohttpmodule init called 2015-01-12 22:03:18,136 [6676] INFO  demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginrequest Called 2015-01-12 22:03:18,136 [6676] INFO  demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule Getpermissionid is called 2015-01-12 22:03:18,136 [6676] INFO  demo.demohttpmodule [(NULL)] < (NULL) >-the URL address is [/ Hl2008/ui/automonitor/135?autorun=true]2015-01-12 22:03:18,136 [6676] INFO  demo.demohttpmodule [(NULL)] < ( NULL) >-Demohttpmodule Context_beginrequest-globaldefine.isautomon = = True is called

After deployment to the production environment, the jquery framework found on the frames page failed. Continue analysis. The Discovery Framework page uses the ScriptManager control, corresponding to the generated HTML code such as:

Check the Web. config file again and add the following configuration in webserver (inspired by the code generated automatically when you create a new Web project):

The configuration in the old web. config corresponding to the preceding code is as follows:

After the modified Web. config, the resulting debug log is as follows:

2015-01-13 17:23:36,107 [6872] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginrequest is tuned With 2015-01-13 17:23:36,107 [6872] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule getpermissionid called 201 5-01-13 17:23:36,107 [6872] INFO demo.demohttpmodule [(NULL)] < (NULL) >-URL address is [/hl2008/webresource.axd?d= Gzmzlqjdafh6odpgsbwp09jjwprybcivixb1dm9gbm8vxmiskaxu6a4u2pqimhglfm7eawqyhr9ywjcvedtxcmft2kuu6k398_  VF7VKU6P0HBARKRVBG1V0HHDL3RUBSR-FJRA2&AMP;T=634134071139291572]2015-01-13 17:23:36,107 [6872] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,107 [6872] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginr Equest-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -Demohttpmodule Context_beginrequest is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -Demohttpmodule Getpermissionid is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-the URL address is [/HL2008/SC Riptresource.axd?d=n98_-sqlq5674unkllgka0owba70uujimsxppasyt8skc5y68fcdhdoe2hzo2_abfm4cji36eipveokx_ Qvvj5tecsi8ecd2ueczevylfplnvkifygrpkkvzzonnzcsoa-cdsoisctqpiqkzhcfg1b-8qfs1&t=434e8d85]2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginrequest is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (nul L) >-Demohttpmodule Getpermissionid is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -The URL address is [/hl2008/scriptresource.axd?d=v9-vun33q_tt6fz_-kdfoxfkktcmxkhtj_xaalnyyri1w9v_8zmlgwwhe_7u5Jrvi61k8tbjhxrwk5pwmxh_ t7arsi5gkkco5frbtk8aoctmmye-z7dxxdxz58vlppixybnc59f5ezhs5uv4zwr1dzu8bau-upwipkdmir9lgzayhbed0&t= FFFFFFFFF9D85FA6]2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule init is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-demohttp Module Context_beginrequest is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-DEMOHT Tpmodule Getpermissionid is called 2015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-the URL address is [/h L2008/scriptresource.axd?d= Cnixn-oepwiqvfr3nfbwbrscpojrsgp3fk5-h9ktsgrmb5erveljutbsfhoow80urkbnl6sq8-0hshzpc4ou2ynakkiuhor-vfpjxtidz2fm420esofumh2wq Gbp5wrVQJPSUT_VVJSYCLTQOJO2YIIOGA_IWOLRD9KQNUVR6IBHOY3U0&AMP;T=434E8D85]2015-01-13 17:23:36,170 [10228] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,170 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginrequest is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (nul L) >-Demohttpmodule Getpermissionid is called 2015-01-13 17:23:36,170 [11096] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -The URL address is [/hl2008/scriptresource.axd?d=gkkeudwtdrtnhm1ma1oioefagffagaw_ Ixjb82opb2ts8p8orcsnrzj-mmuhz0dqtyxbwcapwjhw6ttsgfjag9gue_paiqks-mb5whwblxun3u_  FGJBGRGIJGBLZP5C05BIA63BIG9F1GYS-GW_XTR8IGDU1&AMP;T=434E8D85]2015-01-13 17:23:36,170 [11096] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,170 [110+] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule Context_beginrequest-globaldefine.isautomon = = FA LSE is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginre Quest called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule getpermission Id is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-the URL address is [/hl2008/scriptresource. Axd?d=ihapct_fvguzssekko0hhoh348apf9q6m46cxylkg7wb62p5sdfygaeh8pzg6xdxys7cobuuow4fi-umajxkg_  ADQ3OE0UKQOSHZQC1PCDTV8TBAQJQIN7DSKHFMQ7NANJRSKW2&AMP;T=434E8D85]2015-01-13 17:23:36,185 [10228] INFO Demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-DemohttpmodUle Context_beginrequest is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-DEMOHTTPM Odule Getpermissionid is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-the URL address is [/HL20 08/webresource.axd?d= 5ips5otiyo6ujxlb39golqh4newax7eokozvuihqsqguss98irlkepkpulzkdz8l9ifssht6j2qlr8dgukecsvf1lbm1&t= 634259354654344891]2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_beginrequest is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (nul L) >-Demohttpmodule Getpermissionid is called 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -The URL address is <span style= "color:#ff0000; " >[/hl2008/scriptresource.axd?d= b0mz6yxa5jqouxpa0jogyxkeuisqjxt0qhalr9oqwikr61b8hsajnpplphydrwacrd2qqxeovdt1vmj6zjaoyn4nski5r6cqebmidy_- Kpq9q6lkll0eg-qfovruw1f2a4xfjkznlnqrzbvg0gkmoqqst59kbz_eefl25pkyfjr9zh-90&t=fffffffff9d85fa6</span>] 2015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-After the first regular match: MC. Count = = 02015-01-13 17:23:36,185 [10228] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule context_begin Request-globaldefine.isautomon = = False is called 2015-01-13 17:23:37,730 [5544] INFO demo.demohttpmodule [(NULL)] < (NULL) & Gt -Demohttpmodule Context_beginrequest is called 2015-01-13 17:23:37,730 [5544] INFO demo.demohttpmodule [(NULL)] < (NULL)  >-Demohttpmodule Getpermissionid is called 2015-01-13 17:23:37,730 [5544] INFO demo.demohttpmodule [(NULL)] < (NULL) > -The URL address is [/hl2008/ui/automonitor/135?autorun=true]2015-01-13 17:23:37,745 [5544] INFO demo.demohttpmodule [(NULL)] < (NULL) >-Demohttpmodule Context_begInrequest-globaldefine.isautomon = = True is called 

Once again deployed to the production environment, the problem is finally resolved.
The summary is as follows:

IIS7.5 404, the HttpModule in System.Web is registered to system.webserver modules, and if the application pool is in Classic mode, module is not activated correctly. An abnormal termination occurs.
1. The module can be activated correctly only if the application pool is switched to integrated mode and the httpmodules and httphandlers configuration sections of the system.web are completely erased. (If you do not remove httpmodules and httphandlers registrations used in Classic mode, you must have the validateintegratedmodeconfiguration of the validation element property is set to false to avoid errors. )

2. In integrated mode, the content under httphandlers under system.web in the original Classic mode needs to be migrated to system.webserver. To ensure that the httphandlers (ASP. NET Framework level) works correctly.

PS: Thank CSDN Customer service, this article in the last night around 11 o'clock released, this afternoon to revise this blog post, found that the account was stolen, and this article has been deleted, is the CSND customer service to help me get back the password, and found this article, again, thank you!!

IIS7.5 migration-HTTP error 404.0-not found-0x80070002 error analysis and resolution process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.