MVC series (3) httpruntime detailed analysis (next)

Source: Internet
Author: User
Tags thread

Article content

In other words, after a variety of complicated internal processes we don't know, unmanaged code officially starts calling the Ispairuntime ProcessRequest method (Ispairuntime inherits the Iispairuntime interface, which interacts with COM, and exposes the ProcessRequest interface method). As for why to call this method, uncle is not very clear, can not find Microsoft related information Oh. But the uncle decided that this method is we enter httpruntime the official gate, then see.

public int ProcessRequest (IntPtr ECB, int iwrtype) {IntPtr phttpcompletion = IntPtr.Zero;  
      
        if (Iwrtype = = worker_request_type_in_proc_version_2) {phttpcompletion = ECB;  
      
    ECB = UNSAFENATIVEMETHODS.GETECB (phttpcompletion);  
      
    } isapiworkerrequest WR = null;  
      
        try {bool Useoop = (Iwrtype = = Worker_request_type_oop);  
      
        WR = Isapiworkerrequest.createworkerrequest (ECB, useoop); wr.  
      
       
      
        Initialize ();  
      
        Check if app path matches (need to restart app domain?) String Wrpath = wr.  
      
        Getapppathtranslated ();  
      
       
      
        String ADPath = httpruntime.appdomainapppathinternal;  
      
            if (ADPath = null | |  
      
            Stringutil.equalsignorecase (Wrpath, ADPath)) {Httpruntime.processrequestnodemand (WR);  
      
        return 0;  
     } 
        else {//need to restart app domain Httpruntime.shutdownappdomain (app Licationshutdownreason.physicalapplicationpathchanged, SR. GetString (SR.  
      
                                                                            Hosting_phys_path_changed, ADPath,  
      
            Wrpath));  
      
        return 1; } catch (Exception e) {try {Webbaseevent.raiseruntimeer  
      
        Ror (E, this);  is the catch {}//Have we called hse_req_done_with_session?  
      
        If So, don ' t re-throw. if (WR!= null && WR. ECB = = IntPtr.Zero) {if (phttpcompletion!= intptr.zero) {Unsafenativemeth Ods.  
      
  Setdonewithsessioncalled (phttpcompletion);          }//If this is a thread abort exception, cancel the abort if (E is Th  
      
            readabortexception) {thread.resetabort ();  
      
            }//Important:if this thread is being aborted because of a appdomain.unload, The CLR would still throw an appdomainunloadedexception.  
      
            The native caller//must special case cor_e_appdomainunloaded (0x80131014) and not  
      
            Call hse_req_done_with_session more than once.  
      
        return 0;  
    }//Re-throw If we have not called hse_req_done_with_session throw; }  
}

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.