Analytics


Google
Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Tuesday, December 8, 2009

Migrating from IIS 5/6 to IIS 7 manually

In IIS 7, a new utility is introduced  it is known as appcmd.

In order to run the commands below effectively, you need to open a command prompt session (running as Administrator).  I will not repeat what I have covered in the previous article on IIS 5 to IIS 6 but following the concept covered there, just change some minor approach and use the new command.

It is located in %windir%/system32/inetsrv/appcmd.exe

To get the format for the files needed to configure your virtual directory, the easiest way is to use the command as follows:

%windir%/system32/inetsrv/appcmd list vdir /xml

The output will look like this:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <VDIR physicalPath="%SystemDrive%\inetpub\wwwroot" path="/" APP.NAME="Default Web Site/" VDIR.NAME="Default Web Site/" />
    <VDIR physicalPath="C:\webfiles\t2" path="/test3" APP.NAME="Default Web Site/" VDIR.NAME="Default Web Site/test3" />
    <VDIR physicalPath="C:\webfiles\t3" path="/test4" APP.NAME="Default Web Site/" VDIR.NAME="Default Web Site/test4" />
    <VDIR physicalPath="C:\webfiles\t4" path="/test5" APP.NAME="Default Web Site/" VDIR.NAME="Default Web Site/test5" />
    <VDIR physicalPath="C:\webfiles\t1" path="/" APP.NAME="Default Web Site/test2" VDIR.NAME="Default Web Site/test2/" />
</appcmd>

A few things to note.  If you want to make the virtual folder an application, then you need to change the APP.Name  to include the application name as in the case above where t2 is known as test2.  Also the path is the path relative to the application.

You can then copy this listing and use it as a template for your migration.  To get a list of application pool, use the following command:

%windir%\system32\inetsrv\appcmd list apppool /xml

The output will look like this:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <APPPOOL APPPOOL.NAME="DefaultAppPool" PipelineMode="Integrated" RuntimeVersion="v2.0" state="Started" />
    <APPPOOL APPPOOL.NAME="Classic .NET AppPool" PipelineMode="Classic" RuntimeVersion="v2.0" state="Started" />
    <APPPOOL APPPOOL.NAME="test" PipelineMode="Integrated" RuntimeVersion="v2.0" state="Started" />
    <APPPOOL APPPOOL.NAME="frame1.1" PipelineMode="Integrated" RuntimeVersion="" state="Started" />
</appcmd>

If you want to add as an application folder, a quicker way is to use following command to get the default format:


%windir%\system32\inetsrv\appcmd list app /xml /config

Output will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <APP path="/" APP.NAME="Default Web Site/" APPPOOL.NAME="DefaultAppPool" SITE.NAME="Default Web Site">
        <application path="/">
            <virtualDirectoryDefaults />
            <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" />
            <virtualDirectory path="/test3" physicalPath="C:\webfiles\t2" />
            <virtualDirectory path="/test4" physicalPath="C:\webfiles\t3" />
            <virtualDirectory path="/test5" physicalPath="C:\webfiles\t4" />
        </application>
    </APP>
    <APP path="/test2" APP.NAME="Default Web Site/test2" APPPOOL.NAME="test" SITE.NAME="Default Web Site">
        <application path="/test2" applicationPool="test">
            <virtualDirectoryDefaults />
            <virtualDirectory path="/" physicalPath="C:\webfiles\t1" />
        </application>
    </APP>
</appcmd>

Once you have all the above format, you can then copy into a text editor and add in the required virtual folder or apps that you want to add.  It is probably easier to manually configure the application pools and then use the appcmd to add in the virtual applications.  Once you have your commands ready, use the following command:

For adding virtual directory, type the following command and then it will put you into the next line.  When it does that, paste your XML string to the console.  Once the xml is pasted, add one or two lines at the bottom and press Control Z to mark the end.

%windir%\system32\inetsrv\appcmd add vdir /in


Same with adding app and apppools.


%windir%\system32\inetsrv\appcmd add app /in

Saturday, January 10, 2009

ASP and ASP.Net can't find Oracle

This is from Microsoft Q225084, link also to the following post. Copied here to simplify my reference and not meant to plagiarize. No offense intended.


This article outlines some of the common steps to take when you troubleshoot a problem with a connection to an Oracle Database from an Active Server Pages (ASP) application. Some of the more common error messages are:


Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Oracle][ODBC][Ora]ORA-12154: TNS:Could not resolve service name /vdir/filename.asp, line xxx.


-and-


The Oracle(tm) client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3 (or greater) client software installation.

You will be unable to use this driver until these components have been installed.

=============================


The following is a list of general steps to take when you investigate a connectivity problem between ASP and an Oracle database.
  • First verify that you can connect to Oracle and retrieve data using Oracle's SQL Plus utility (a command line-based query utility). If you cannot connect from this tool, then you either have a bad installation or configuration of the Oracle client components or you did not correctly use the SQL Net Easy Config or Oracle Net8 Easy Config utility to create an alias for the Oracle server. You must work with your Oracle database administrator to make sure that the necessary Oracle components have been installed and are configured correctly.
  • If the Oracle client was recently installed on the Internet Information Server (IIS) computer, make sure that the computer has been rebooted at least once. In some cases after installation, the Oracle component SQL Plus works fine, but connectivity from IIS does not work until you reboot the computer.
  • Look for multiple copies of the OCIW32.dll file on the IIS server. There should only be one copy of this .dll file on the computer, and it should be in the \Bin subfolder of the Oracle home folder. If you find other copies, rename these with a .bak extension and then retest connectivity. You may want to restart the IIS services after renaming any additional copies of the .dll file that you found.
  • Make sure that you are running the recommended versions of the Oracle components.
  • For more information on how to obtain and install these patches, work with your database administrator or contact Oracle Technical Support. (Microsoft Technical Support does not support the configuration of these Oracle components.
  • Check to make sure that the Oracle client components are installed locally on the IIS server. While it is possible to get other applications to work without the Oracle components installed locally, this causes problems when you work with ASP applications. Microsoft recommends that these components be installed on the IIS server; other custom configurations are not supported.
  • Look at the system environment variables on the IIS computer and check the PATH variable. If there are any remote share names or mapped drives that point to locations that contain Oracle components, remove them. You must reboot the computer in order for any changes that you make to take effect.
  • Look again at the system environment variables on the IIS computer and check the PATH variable. Make sure that the \Bin folder in the Oracle home directory is included as part of the PATH environment variable. With a default installation, this is the Orant\Bin folder. Again, you must reboot the computer for the changes that you make to take effect.
  • Try to connect with both the Microsoft ODBC for Oracle driver and the Microsoft OLEDB Provider for Oracle. Here are sample connection string syntax for each of these:
'Microsoft OLEDB Provider for Oracle
"Provider=MSDAORA.1;Data Source=Your_TNSNames_Alias;User ID=User;Password=Password"

'Microsoft ODBC for Oracle DSN-Less
"Provider=MSDASQL;DRIVER={Microsoft ODBC for ORACLE};UID=User;PWD=Password;Server=Your_TNSNames_Alias"

'Microsoft ODBC for Oracle using a DSN
"DSN=Your_DSN_Name;UID=User;PWD=Password"

  • Disable SQL*Net Authentication. To do this, edit the SQLNET.ora file. This configuration file is usually stored in the Network\Admin subfolder of the Oracle home folder. Add the following lines to this file:
SQLNET.AUTHENTICATION_SERVICES = (none)
SQLNET.AUTHENTICATION = (none)

Restart the IIS service after you make these changes.
  • Add the IUSR_machine name account and the IWAM_machine name account to the Oracle home folder. Give both accounts full control.

To do this, right-click on the Oracle home folder in Windows Explorer. Click Properties, and then click the Security tab. Add the appropriate accounts and then give them full control. Restart your computer.
The third-party products that are discussed in this article are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.

Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

Thursday, July 31, 2008

Directing your IIS SMTP Traffic

You can make your Windows your SMTP host to help your programs send out mail. Setting up SMTP is relatively simple, just go to the Add/Remove Windows Components in the Add/Remove Programs in the Control Panel and add it as you do with IIS.

Once completed, it will use the companies default gateway which is determined by the MBX entries in your companies DNS. However, that may not be the closes internet gateway for your company (if your company has multiple gateway) and more likely that is also the busiest gateway.

To overcome this, you can specify the smarthost in the SMTP configuration to tell the server to direct the mails it routes to an alternate gateway. To do that right click on the Default SMTP Virtual Server and Select Properties. You will then see the following:



Click on Advanced, then enter your gateway host address as well as your own domain. In this example, I use Programmersjournal.blogspot.com as my domain name and smtp.yahoo.com as the gateway. Both are pseudonyms meant for illustration only.

Wednesday, July 2, 2008

IIS Application Pool - don't mix your framework

In IIS, we can convert each virtual folder into an Application Folder. We can then configure the Application to run a specific version of the .Net Framework.

When IIS 6 was introduced with Windows 2003, Application Pools were also introduced to improved the stability of IIS. You can then group applications into an Application pool. So you can dedicate application pool for critical application or group them accordingly.

This week, I found there is one thing that should be considered when grouping these applications. Make sure that all the applications grouped under the same application pool is running on the same Framework version. I found out the hardware, when we upgraded one of the application to Framework 2.0 which support multilingual feature in asp.net.

However, after that we found that we kept hitting error "Application Not Available" and had to restart the application pool to get the application back. It happens intermittently between the Framework 2.0 application and the Framework 1.1 application.

I suspect it is caused by the cache in the worker process.

Tuesday, June 24, 2008

Migrating from IIS 5 to IIS 6 - manual way

A few years back I tried to migrate from IIS 5 to IIS 6 with the tools provided but failed miserably. It is probably because of how we structured our content. Most of the resources I found refers to IIS Migration Tool because it is the easiest way to migrate. However, it may not work for some of you.

Microsoft expects most of our pages to be placed in c:\inetpub\wwwroot but it provides you an option to map any folder you can find on the server. The methods illustrated here are only works with Windows 2003 (it does not work with Windows XP.

Assuming that you started a new Windows 2003 server, first thing is to copy the codes from old server. Next right click on the IIS as follows:






This will generate a XML file containing all the information needed to generate the website.

Edit the xml file and then find the section showing IIsWebVirtualDir as shown below and then duplicate it. Replace the mapping with the ons you need:

<IIsWebVirtualDir Location ="/LM/W3SVC/1/ROOT/engr"
AccessFlags="AccessRead | AccessScript"
AppFriendlyName=""
AppIsolated="2"
AppRoot="/LM/W3SVC/1/ROOT/engr"
DirBrowseFlags="DirBrowseShowDate | DirBrowseShowTime | DirBrowseShowSize | DirBrowseShowExtension | DirBrowseShowLongDate | EnableDefaultDoc"
Path="E:\engr"
>
<Custom
Name="Win32Error"
ID="1099"
Value="0"
Type="DWORD"
UserType="IIS_MD_UT_SERVER"
Attributes="INHERIT"
/>
</IIsWebVirtualDir>


In the case above, the virtual directory is engr, so you should be able access it via http://localhost/engr/... The physical folder in the above exmaple is e:\engr.

You can then edit and map the folder accordingly. Assuming you have configured the IIS to use Framework 1.1, then you will see the following (which defines the default .Net framework when you configure an application):
<IIsWebVirtualDir Location ="/LM/W3SVC/1/ROOT"
AccessFlags="AccessRead | AccessScript"
AppFriendlyName=""
AppIsolated="2"
AppPoolId="DefaultAppPool"
AppRoot="/LM/W3SVC/1/ROOT"
AspEnableParentPaths="TRUE"
AuthFlags="AuthAnonymous | AuthNTLM"
DefaultDoc="Default.htm,Default.asp,iisstart.asp,Default.aspx,index.html"
HttpCustomHeaders="MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET"
MimeMap=".chw,application/octet-stream
.lic,application/octet-stream"
Path="E:\webfiles\wwwroot"
ScriptMaps=".asa,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.asax,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ascx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ashx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asmx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asp,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.aspx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.axd,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.cdx,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.cer,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.config,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.cs,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.csproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.idc,C:\WINDOWS\system32\inetsrv\httpodbc.dll,5,GET,POST
.licx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.rem,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.resources,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.resx,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.shtm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.shtml,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.soap,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.stm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.vb,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vbproj,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vsdisco,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.webinfo,C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG"
UNCPassword="49634462500000000600000040000000822fdfd482b3000000000000420032004300390042003700420034004600330034004400300038004200320031003100300041003500350039003100460037005d00000000000000"
>

Virtual folders that needs to use a framework other then the default will need to specify more as in:

<IIsWebVirtualDir Location ="/LM/W3SVC/1/ROOT/Test2"
AccessFlags="AccessRead | AccessScript"
AppFriendlyName=""
AppIsolated="2"
AppRoot="/LM/W3SVC/1/ROOT/TEST2"
DirBrowseFlags="DirBrowseShowDate | DirBrowseShowTime | DirBrowseShowSize | DirBrowseShowExtension | DirBrowseShowLongDate | EnableDefaultDoc"
Path="E:\testWEb\Test2"
ScriptMaps=".asa,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.asax,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ascx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ashx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asmx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.asp,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.aspx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.axd,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.cdx,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.cer,C:\WINDOWS\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE
.config,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.cs,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.csproj,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.idc,C:\WINDOWS\system32\inetsrv\httpodbc.dll,5,GET,POST
.licx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.rem,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.resources,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.resx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.shtm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.shtml,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.soap,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.stm,C:\WINDOWS\system32\inetsrv\ssinc.dll,5,GET,POST
.vb,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vbproj,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vsdisco,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.webinfo,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.master,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.skin,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.compiled,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.browser,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.mdb,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.jsl,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.vjsproj,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.sitemap,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.msgx,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.ad,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.dd,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ldd,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.sd,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.cd,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.adprototype,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.lddprototype,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.sdm,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.sdmDocument,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ldb,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.svc,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG
.mdf,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.ldf,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.java,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.exclude,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG
.refresh,c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG"
>
</IIsWebVirtualDir>


Once you have modified and finalized your file, you can then import it in by right clicking on the IIS and then select new and then create Web Site (from file).



This trick can also be done on the folder level just right clicking on a specific folder get the smaller file. You can then edit the smaller file and add other folders. This is much faster then manually creating individual virtual folders. Once complete then you can use the above to create New Virtual Directory (from file).

Thursday, June 19, 2008

Sometimes we just need to reboot the server

Our team develops a lot of web applications (asp and asp.net). However, we have seen several occasions when our program stops working properly. We are currently working with Windows 2000, so we use IIs5Recycle to improve the stability of the server.

I thought I will share some of the problems we saw and the solutions:


1. Selected pages stop responding while others continue to respond.
- In this case, we found that one of our Oracle stored packages became invalid. Once we recompiled the invalid package, everything returned to normal.

2. All pages suddenly slowed down or only asp.net pages stopped responding.
- One of the asp.net pages hit a contention and chewed up all the cpu.
- Stopping and starting the web publishing service did not help.
- Solution is to simply kill the asp.net process.

3. We use awstat to collect compile usage statistics of our website and suddenly, we encounter that the page was sending incomplete/invalid header.
- I tried many things but finally a reboot just fixes it.



We have seen also many cases when the pages started misbehaving, invalid access etc. So word of advise, before jumping into conclusion that the problem is with the code, try the following sequence:
  1. See if asp.net is chewing up all your cpu. If so, just kill it and the web server should return to normal. However, a note of caution, this should be done only if your server is not under powered and 100% cpu is not a normal occurrence.
  2. Use the services and stop and restart "World Wide Web Publishing Service". It should be last service in the list (default listing).
  3. Last resort, reboot Windows.
Windows 2003 provides a more robust IIS and introduces the concept of application pools. Instead of asp.net processes, you will now see w3wp.exe processes. These are the worker processes and you will see at least one for each running pool - you may see more.

Still the concept is similar.

Saturday, March 29, 2008

ASP.Net behavior in IIS

A friend of mine highlighted this article to me:

http://aspnetresources.com/articles/debug_code_in_production.aspx

Even though the article referred to Framework 1.1 but it looks like it is still applicable for Framework 2.0, 3.0 and 3.5.

Some of my key take aways from the article are:

  1. When deploying an application, it is critical to remember to change the debug to false.
  2. Frequent changes on the aspx files will also generate additional files which will only be removed when the application is restarted or the web.config is edited.
  3. Too many aspx files in a folder will incur high start up time, since compilation happens to many files even though only one is accessed.
<compilation debug="false" />
There are a lot more information there and I believe is critical for developers too.

Side Note

On the server (hosting your application), you should always configure your antivirus not to scan your web.config, global.asax and global.asa. From my experience:
  • the act of the antivirus scanning will cause IIS to detect those as changes to those files and will force a restart on the applications.
  • And the very act of accessing any of those pages, will cause the antivirus to scan those files.
Consequently, you may end up with an application that will only allow one person to access the application.