Ok, I think I have this working now...
It appears to be a combination of two issues.
- Apparently Wordpress Mu needs multiple rewrite rules in IIS 7 not just one.
- You should omit the www. before your domain in several places or you're going to encounter some strange issues
At one point I decided it would be a good idea to see what was in the .htaccess files even though IIS 7 is not using them. What I found was there was several rewrite rules in the .htaccess file in my wwwroot folder (See below for it's contents). I went into IIS 7's url rewrite configuration and disabled my previous rewrite rule and did an "import rules..." from my .htaccess file. Before the import would work I had to remove the line that said "RewriteBase" to get the .htaccess file to import (not sure what the implications of this are but it seems to not be causing any issues). 7 rules were imported. I then opened web.config and changed all references of {SCRIPT_NAME} to {URL}, as mentioned in Importing Apache mod_rewrite Rules. At this point some of my problems started to go away (such as css and images loading correctly for the secondary blog, etc). See below for the changes to my web.config for the URL Rewrite modules.
I then attempted to log into my secondary blog's wp-admin. However what I kept getting was the login page (after logging in it just kept redirecting me back to there, even if I directly typed in domain.com/wp-admin). What I eventually figured out was the www. needed to be removed from several places for both my main blog and my secondary blog. The first place was in the wp-admin for the primary blog (go to Site Admin -> Blogs), then remove the www. in the domain property and click the update options button. I also had to change define('DOMAIN_CURRENT_SITE', 'www.domain.com' ); to define('DOMAIN_CURRENT_SITE', 'domain.com' ); in my wp-config.php file.
It now appears that the site is working as expected. Let me know if there are any problems with this approach or anything I might have missed here.
My IIS 7 web.config file in wwwroot changed from this:
<rewrite>
<rules>
<clear />
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rewrite>
To this:
<rewrite>
<rules>
<clear />
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*/)?files/$" ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(.*/)?files/(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" negate="true" pattern=".*wp-content/plugins.*" ignoreCase="false" />
</conditions>
<action type="Rewrite" url="wp-content/blogs.php?file={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^(.+)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^.*/wp-admin$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="{R:1}/" redirectType="Permanent" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsFile" pattern="" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" pattern="" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="Imported Rule 5" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(wp-.*)" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="Imported Rule 6" stopProcessing="true">
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
<action type="Rewrite" url="{R:2}" />
</rule>
<rule name="Imported Rule 7" stopProcessing="true">
<match url="." ignoreCase="false" />
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
Contents of .htaccess in wwwroot folder:
RewriteEngine On
RewriteBase /
#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteCond %{REQUEST_URI} ^.*/wp-admin$
RewriteRule ^(.+)$ $1/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>