April, 2008

April, 2008

  • Care, Share and Grow!

    Change in IIS MMC setting may cause unwanted restarts of W3SVC

    • 5 Comments

    Recently we have discovered an issue with IIS Manager wherein changing settings in a certain way may cause unexpected restart of World wide Web Publishing Service. And this may happen before you realize until you go back to the Application event log and find entries corresponding to the W3SVC restart event as shown below:

    Event Type:    Information
    Event Source:    ASP.NET 2.0.50727.0
    Event Category:    None
    Event ID:    1023
    Date:        4/22/2008
    Time:        6:35:20 AM
    User:        N/A
    Computer:    SAURABSI-SEC
    Description:
    Restarting W3SVC

    Event Type:    Information
    Event Source:    ASP.NET 2.0.50727.0
    Event Category:    None
    Event ID:    1025
    Date:        4/22/2008
    Time:        6:35:25 AM
    User:        N/A
    Computer:    SAURABSI-SEC
    Description:
    Finish restarting W3SVC

    Also as part of the above symptom, you will see IIS mmc paused like in a hung state (you may see a transient hour glass).
    So what are the steps you need to be cautious of especially in a production environment?

    First, a little background...

    If you intend to change the version of ASP.Net through IIS manager by going to the Web Site properties --> ASP.Net tab, you should be fully aware that W3SVC service will get restarted in order to reflect the change. Restarting of W3SVC will lead to all the application pools getting recycled along with it, hence leading to all your currently running web applications to spawn new worker processes for further requests. This is by design and if you want to circumvent the recycling of other application pools not corresponding to your website, you should have a way to control W3SVC restart after the version change. You can do so by following this excellent post by Jerry Orman.

    So far so good. But I have something else to disclose too.

    Let's say you go to the IIS manager, select a Web site, go to its properties and poke around with different settings. At some point you visit ASP.Net tab (even if you do not modify any settings like current ASP.Net version) and move out from there to some other tab. On this tab if you do any change(s), and you click on Apply and then OK (in the same order) bang!, your W3SVC service will restart and all your application pools will recycle subsequently as a result of it.

    Here are some quick steps to reproduce the problem, follow it to believe it.

    1) Open IIS manager (Start -> Run -> inetmgr.exe)
    2) Select any website --> right click and select properties
    3) Click on ASP.NET TAB - do not change or modify anything - just click on the TAB.

     image

    4) Now click on any other TAB and change some values (for example: go to website tab and change port to say 8080 from 80)
    5) Hit apply
    6) Hit OK
    7) This will restart W3SVC and you will see following event in application event logs.

    In the above steps the key points are basically to visit the ASP.NET TAB and then click on Apply and then OK to reproduce the issue.

    Why is this behavior?
    ===================
    The reason this behavior occurs is in the code where we make a check to see if ASP.NET runtime version is changed and if yes we need to fire W3SVC restart. We are comparing the selected version of ASP.NET TAB with what has been changed incorrectly. There is an additional code in place that checks for the QFE versions of the ASP.NET framework installed, but in the IIS manager UI, we only give an option to either select 1.x.xxxx or 2.0.xxxxx. We really don’t care about the QFE versions installed after that. But the code that gets executed on OK or APPLY does. For the 1st execution (i.e. click on APPLY) it’s correctly able to remove the QFE information from the version string it retrieved (i.e. 2.0.xxxxx, instead of 2.0.xxxxx.QFE), the check is successful noting that nothing is changed in ASP.NET TAB, and hence no restart of W3SVC is required. But now when we go ahead with 2nd execution (i.e. click on OK) the same code executes again and this time the version information string is truncated further to RTM (i.e. to 2.0 from 2.0.xxxxx) and thus the check fails (ASP.Net version is changed from 2.0.xxxxx to 2.0), which incorrectly indicates that ASP.NET runtime version has been changed and thus calls a restart of W3SVC.

    In short, you could click anywhere in UI all day long, but for you to reproduce this issue, you need to
    1) Go to ASP.NET UI once.
    2) Click APPLY and OK (both in that order). If you only click OK then the code gets executed only once and hence correctly and would not restart the w3svc.

    Latest update on this:

    We have informed the Product group about this issue. A Knowledge base article is in work.

    Laterz!
    Saurabh

  • Care, Share and Grow!

    Unable to access IIsCertMapper object through ADSI

    • 7 Comments

    Today, I was working on an issue where we were trying to add mapping for client certificate for a windows account using ADSI and VBScript. Something similar as below:

    <%
      Dim CertObj, vCert
      vCert = Request.ClientCertificate("CERTIFICATE")
      Set CertObj = GetObject("IIS://<path>/IIsCertMapper")
      CertObj.CreateMapping vCert, "MYACCT", "MYPASS", "My Name", True
    %>

    where path is in the format: "<IISServerName>/W3SVC/<Identifier>"
    However, script was failing on the 3rd line,

    Set CertObj = GetObject("IIS://<path>/IIsCertMapper")

    We get “Path not found error”, 80070003. Now this is an expected behavior if this object type is not found in the IIS's metabase. You can search for the above in metabase.xml file. Ideally this should have been there, but since we did not have this, to make it work we had to manually create this for a website in question.

    You can try this to have the necessary object type:

    > cscript adsutil.vbs CREATE w3svc/1/IIsCertMapper  "IIsCertMapper"     

    Microsoft (R) Windows Script Host Version 5.6

    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

    created "w3svc/1/IIsCertMapper"

    >

    Here 1 is the identifier for the website in question and "IIsCertMapper" is the Object type.

    Once done, try restarting IIS services as like (IISRESET from the cmd prompt).

    Open the metabase.xml and now we should see an entry as below:

    <IIsCertMapper    Location ="/LM/W3SVC/1/IIsCertMapper"
        >
    </IIsCertMapper>

    Once this entry was created in the metabase.xml we should be able to access this object via ADSI script. This is not only applicable to a specific object type like IIsCertMapper but any other object type associated with IIS.

    Hope this helps someone, somewhere, somehow ;-)

  • Care, Share and Grow!

    IIS ASP.Net Developer Support Group comes with its own Weblog

    • 1 Comments

    Recently we have come up with a dedicated blog site for IIS support group. Our aim is to include topics which will be of relevance to end users with regard to troubleshooting, and technical readiness for IIS ASP.Net including the latest in offering i.e. IIS 7.0. Using this as a medium we will try to provide information on matters closely related to IIS and Web applications built in ASP/ASP.Net etc. I am myself being one of the bloggers for this site http://blogs.msdn.com/webtopics .

    Watch out for some useful posts to come in future from the entire group here...

Page 1 of 1 (3 items)