Not working on vdirs / vhosts on IIS 6

Aug 23, 2011 at 9:47 AM

I installed IIRF 2.1.2.0 using the Iirf2.1-x86.msi installer on a Windows 2003 Server with IIS 6 for all websites.

I added a line "StatusInquiry ON" to the global INI file.

I added a simple INI file to the vdir of the default web site, which just contains

RewriteLog c:\temp\rewrite
RewriteLogLevel 3

StatusInquiry ON /iirfStatus RemoteOk

(also tried just "StatusInquiry ON RemoteOk")

Next thing to do was to try and see if IIRF is really up and running by calling /iirfStatus

It works fine for the default web site, but not for any of the other web sites (i.e. vhosts).
I always get a 404 for any of the other websites (some do have a INI file in their physical
directory, others don't).

I went through the trouble shooting section of the documentation, forum discussions and other
websites, to see if there is any hint to what I might do wrong.

- The green arrow of the module is shown in the ISAPI tab of the "websites" properties.
- I also checked the configuration of the home directory. The path to IIRF is there.
- Then I checked directory permissions. Permissions are granted to IIS_WPG (read, execute, list directory) and
 IIS_<machine_name>. I also added further users, like the web users of the particular vhosts, and then even for
"everybody". No success.
- I checked the Event log. NO errors.
- I checked the log files. No errors, but entries only if I call the default web site. For any
other web site (vhost) there are no entries at all.

Next thing I did is to manually remove IIRF and install it at a different location, because the
original installation has spaces in the path. So I moved everything to C:\WINDOWS\system32\inetsrv\iirf.
Access permissions are granted, IIRF is up and running after a restart of IIS (green arrow visible),
status page for default web site is visible.

So it is exactly the same behaviour as before.

What do I need to do in order to make my vhosts also load / use IIRF, so that I can see the status page and
an entry in the logfile?

(default website is at C:\Inetpub\vhosts\default\htdocs. Other websites at C:\Inetpub\vhosts\domain.tld\httpdocs)

Here's the status report of the default web site. I can all it both by localhost and remotely by IP:


IIRF Status Report
IIRF Global Status
------------------
IIRF Version Ionic ISAPI Rewriting Filter (IIRF) 2.1.2.0 x86 RELEASE
Built on Aug 17 2011 09:58:52
Filter DLL C:\WINDOWS\system32\inetsrv\iirf\IIRF.dll
PCRE Version 8.02 2010-03-19
IIRF Started 2011/08/23 10:08:03 Mitteleuropäische Sommerzeit
Current time 2011/08/23 10:09:38 Mitteleuropäische Sommerzeit
Server Ini file C:\WINDOWS\system32\inetsrv\iirf\IirfGlobal.ini
Last Update of Ini 2011/08/21 22:56:22 Mitteleuropäische Sommerzeit
#Lines 69
#Warnings 0
Rewrite Engine (all vdirs) ON

IIRF Vdir Status
-----------------
APPL_MD_PATH /LM/W3SVC/1/ROOT
Root Vdir Ini File C:\Inetpub\vhosts\default\htdocs\Iirf.ini
Ini file timestamp 2011/08/21 23:22:23 Mitteleuropäische Sommerzeit
Last read 2011/08/23 10:08:03 Mitteleuropäische Sommerzeit
#Ini Modules 1
#Lines 13
#Rules 0
#Warnings 0
#Errors 0
Log file C:\temp\rewrite\rewrite.log.24552.log
Log level 3
Rewrite Engine ON
Rewrite Base '--'
Remote Status Inquiry enabled
Cond substring flag *
Case conversion flag #
URL Decoding ON
Iteration Limit 8
Proxy Timeouts (sec.) Resolve=30 Connect=30 Send=30 Receive=30
#Requests Processed 2

I really don't know where else to see or what else to do...

Coordinator
Aug 24, 2011 at 3:45 PM

It sure sounds like IIRF is not installed on the "other vhosts".

I don't know what a "vhost" is, in the context of IIS.  Are you just using multiple vdirs?  Or are you using multiple websites?  Not clear.

If you are merely using multiple vdirs, and if your IIRF is installed at the server level, then it should "just work". But from what you're reporting, IIRF is installed on only one vdir. I may be misunderstanding. Like I said, I don't know what a "vhost" is in IIS.  As far as I know there is no such thing.

Double check the installation, paying attention to whether IIRF is installed Server-wide or for specific websites.  Triple check it.  Spaces in the path where IIRF is installed, don't matter.

> I installed IIRF ....for all websites.

What does that mean?  Did you install it server-wide?  Or did you install it N times, once for each website? or...? something else?    maybe you could post some screen-shots of the IIS MMC panels.

 

Aug 25, 2011 at 3:22 PM

Hi Cheeso,

thanks for your reply. I am sorry that I was not able to express myself clearly enough, the reason is that I am new to IIS direct administration and usually I only configure it using Parallels Plesk. I am more used to Apache, which uses the term "vhost" for any virtual hosts, i.e. multiple domains served by one physical server with a single IP address.

There are so many different terms for IIS: "virtual directory", "application", and there are "vhost" directories in "C:\Inetpub\" like "C:\Inetpub\vhosts\default\htdocs", "C:\Inetpub\vhosts\domain1.tld\httpdocs", , "C:\Inetpub\vhosts\domain2.tld\httpdocs", ..., which I guess are just the physcial directories for the vdirs...?

Now back to explain what I did.

I installed it "server-wide". That's what I selected in the installation wizard (and also when I installed it manually, I used the "websites" category (or tree item) of the IIS Administration tool, not the category name / subtree item of an individual web site (or web application?)).

Now, if you say "If you are merely using multiple vdirs, and if your IIRF is installed at the server level, then it should "just work".", then I guess that's what I do (without knowing it for sure). As I said, I have multiple physical directories like

"C:\Inetpub\vhosts\default\htdocs"
"C:\Inetpub\vhosts\domain1.tld\httpdocs"
"C:\Inetpub\vhosts\domain2.tld\httpdocs"
...

For each of the "C:\Inetpub\vhosts\domain?.tld\httpdocs" directories, there is a subtree item under the "websites" tree item in the IIS Administrator application.

Therefore I guess, I am just using multiple vdirs. (Is that so, how can I tell?)

But on the other hand, I now de-installed everything, then manually installed it for just one web site (application / vdir / whatever).

In that case, I can call /iirfStatus and watch the results page (I replaced the actual domain name by domain?.tld):

IIRF Status Report
IIRF Global Status
------------------
IIRF Version Ionic ISAPI Rewriting Filter (IIRF) 2.1.2.0 x86 RELEASE
Built on Aug 17 2011 09:58:52
Filter DLL C:\WINDOWS\system32\inetsrv\iirf\IIRF.dll
PCRE Version 8.02 2010-03-19
IIRF Started 2011/08/25 15:06:15 Mitteleuropäische Sommerzeit
Current time 2011/08/25 15:43:12 Mitteleuropäische Sommerzeit
Server Ini file C:\WINDOWS\system32\inetsrv\iirf\IirfGlobal.ini
Last Update of Ini 2011/08/21 22:56:22 Mitteleuropäische Sommerzeit
#Lines 69
#Warnings 0
Rewrite Engine (all vdirs) ON

IIRF Vdir Status
-----------------
APPL_MD_PATH /LM/W3SVC/16099/Root
Root Vdir Ini File C:\Inetpub\vhosts\domain.tld\httpdocs\Iirf.ini
Ini file timestamp 2011/08/23 19:49:46 Mitteleuropäische Sommerzeit
Last read 2011/08/25 15:06:15 Mitteleuropäische Sommerzeit
#Ini Modules 1
#Lines 12
#Rules 2
#Warnings 0
#Errors 0
Log file C:\temp\rewrite\rewrite.20304.log
Log level 3
Rewrite Engine ON
Rewrite Base '--'
Remote Status Inquiry enabled
Cond substring flag *
Case conversion flag #
URL Decoding ON
Iteration Limit 8
Proxy Timeouts (sec.) Resolve=30 Connect=30 Send=30 Receive=30
#Requests Processed 10

 What makes me think that I am NOT just using just vdirs is that I had to grant extra rights to the log file directory to the specific webuser (can't remember exactly, but I think it was something like "IUSR_xyz", where xyz was the domain user.

And, after log files were successfully created, they had a different process ID.

Also, the APPL_MD_PATH is different from that of the default website: /LM/W3SVC/16099/Root vs. /LM/W3SVC/1/ROOT.

I read in the documentation, that IIRF needs to load the DLL for each w3scv.exe process individually, and hence cannot redirect/rewrite across multiple domains running on the same physical server. As I understand it, IIS creates a w3svc for each domain (web application) for security reasons.

Could it be that under these circumstances, I cannot use a server-wide installation, without forcing IIS to run in IIS 5.0 compatible mode (which I am not allowed to do)?

 

Anyways, even though I am too dumb to get it up and running server-wide, it seems to be great work. The documentation is really good and as far as I can see, it is pretty much compatible to Apaches mod_rewrite. Only thing that really annoys me is that I seem to be the only one not being capable of getting it running server wide.

 

Coordinator
Aug 26, 2011 at 9:11 PM
Edited Aug 26, 2011 at 10:01 PM

> Also, the APPL_MD_PATH is different from that of the default website: /LM/W3SVC/16099/Root vs. /LM/W3SVC/1/ROOT.

APPL_MD_PATH refers to the "metadata path of the IIS application".  IIS historically stored its configuration in a hierarchically organized tree, and the APPL_MD_PATH just is a key into the tree of configuration information.  Think of it as the internal key corresponding to the IIS Application.  IIS Application is a concept that most closely resembles the Apache vdir. For most purposes you can ignore the difference.  The IIS vdir is similar to the IIS application, except for the APPL_MD_PATH, which gives the administrator the opportunity to set specific configuration for that vdir which may differ from any parent vdir.  If you have a vdir you can "promote" it to become an application.  You can think of an IIS application as a special flavor of an IIS vdir that is configurable at a finer-grained level. For most purposes in IIS, the terms vdir and application are equivalent.  In retrospect, it is silly to even have the distinction, but... it is what it is.

I am not sure what you are referring to when you say "items under the websites node".  A picture would help me see it.  The IIS Admin console allows you to specify multiple websites- these are addressable at distinct TCPIP ports on your server.   Under each website you can configure multiple vdirs and/or applications.   I'm not sure if you are saying you have multiple websites, or multiple vdirs.  

> I read in the documentation, that IIRF needs to load the DLL for each w3scv.exe process individually, and hence cannot redirect/rewrite across multiple domains running on the same physical server.

Thank you for reading the documentation.  IIRF cannot redirect across instances of w3svc.exe . This is not the same as "multiple domains".  There are one or more w3svc.exe processes created for each application pool.  Distinct websites may map to the same application pool, or they may map to different pools.

> As I understand it, IIS creates a w3svc for each domain (web application) for security reasons.

I don't think this is true.  "Domain" is not the applicable administrative concept here.  IIS allows you to define an app pool, which is really some parameters governing process management, or more accurately, "management of the instances of the w3svc.exe process".  It lets you say, for example, whether it should be a 32-bit process or 64; how long the receive queue should be; the idle time threshold; the Windows identity to use for the pool; the memory usage thresholds; and so on.  You then map vdirs/apps to app pools.  Via the IIS admin console, You can map vdirs from different websites to the same app pool.  Or you can map each vdir to a different app pool.  The "domain" used to address the vdir or website has nothing to do with it. 

> Could it be that under these circumstances, I cannot use a server-wide installation, without forcing IIS to run in IIS 5.0 compatible mode (which I am not allowed to do)?

It is possible to define multiple distinct app pools on a server, and some of them are 32 bit, while others are 64 bit. In that case if you want to run IIRF in both app pools, you would need to install the 32-bit flavor of IIRF as well as the 64-bit version, and you'd need to configure IIRF manually and separately for those cases.

I don't know if that's what you are doing but I'd bet not, since you haven't mentioned the app pools at all, to this point.

Aug 29, 2011 at 11:35 AM

Hi Cheeso,

thank you very much for your detailed explanation.

In order to clarify the setup of my webserver, I will create some screenshots the next days (hopefully I will find time for this this evening).

In the mean time, I simply configured IIRF not to run server-wide, but only for the domain where I really need URL rewriting. Rewriting worked right away with no further trouble encountered (after fixing some syntax errors in my Iirf.ini,, of course, but that was easy to fix thanks to the logging of IIRF).

I must say, documentation is really good, especially your introduction to regex syntax is very comprehensive. Great work!

Aug 29, 2011 at 8:50 PM

Hi Cheeso,

now I can present some screenshots.

Here is the basic structure of my IIS setup:

 

 

The are multiple application pools under the "Anwendungspools" tree branch, and multiple web sites under the "Websites" tree branch.

Most of the web sites are assigned to the "Plesk" application pool. The default web site ("Standardwebseite") is assigned to the DefaultAppPool, so it uses a different application pool.

Let's see what is under the default web site:

 There are virtual directories (those with the world on top of the folder icon), physical directories (those with the standard folder icon) and what I guess is supposed to be applications (those with the gear wheel). As you said, they are a virtual directory promoted to be an application.

So, when I say I have multiple web sites, I mean multiple entries under the "Websites" tree branch, just as in your example image "Default Web Site" and "Secondary Web Site". Each web site has multiple virtual and physical directories and some also have virtual directories promoted to be an application.

Now what I was expecting to happen was that when I install IIRF server-wide, then I expected it to load and do its work for all web site listed underneath the "Websites" tree branch. That includes the default web site and all other websites. However, the server-wide installation only runs for the default web site. I guess this is due to the fact that it runs under the "DefaultAppPool" whereas all others use a different app pool.

Still, I don't have a deep enough understanding of the whole thing, so I can only guess that this might be the reason. And I don't know what needs to be done to install it server wide and make it run for all web sites running under the "Plesk" app pool, instead. Making it run for a single web site is no problem, but it is not very efficient if I need to handle more than 10 web sites (which is the case). So I'd be interested in what I can do, although I don't want to steal your time just because I am not familiar with IIS. I can also try to read the IIS documentation and find my way through, but of course I am thankful for any useful hint.

Coordinator
Aug 31, 2011 at 5:25 PM

ok I understand very clearly now.  I understand the situation and your concerns about ease-of-management

Looks like you have IIS6?  I don't have an older server to try this on, but normally when you install an ISaPI, you specify whether it is site specific or global.  If it is global then it runs on all sites.

See here: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/54c41c83-3723-4695-9bf1-9f7b1f674be0.mspx?mfr=true

 

Sep 1, 2011 at 8:34 AM

Hi Cheeso,

thank you for the link to microsoft. They describe exactly what I did (and what your setup does, when I compare settings after automatic
and manual installation). Yet, a server-wide installation does not work on my server, but as I said before, this must be due to some
configuration problem on my server and not due to some IIRF bug. I will have to look after this, should I find some spare time for this.

In the mean while, I am happy with the "by website" installation. I need URL rewriting only for some websites, so it is okay for me
to have to install it multiple times (manually, then). So let's consider this "Support case" closed.

Thank you very much for your time!

Coordinator
Sep 1, 2011 at 3:52 PM

OK thanks for letting me know.

good lck.