Summary:

When running copies of CRM 7.1 and 7.2 on the same machine (e.g. in a developer or test environment), you will find that installing a patch update to 7.1 removes the Rewrite Module settings for 7.2 from your SDATA virtual directory. This is by design; installing 7.1 will recreate the SDATA application, which does not use the URL Rewrite module in that version.

It is possible to recreate the URL Rewrite Module aliases by running a v7.2 installer, selecting the Change Existing install of CRM option, then the IIS Aliases component. However, it is also possible to add the settings using appcmd, and a rules definition file.

Steps to resolve:

1. The below assumes that you're using a CRM instance named CRM72 - you will need to change this in the highlighted areas below if your v7.2 install uses a different instance name. You will also need to know your Tomcat HTTP port - this can be read from \<CRM instance>\tomcat\conf\server.xml:

    <Connector port="10009" protocol="HTTP/1.1"
        connectionTimeout="20000"
        redirectPort="8443" />

2. Save the following to a file named CRMRules.xml:

<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
    <CONFIG CONFIG.SECTION="system.webServer/rewrite/rules" path="MACHINE/WEBROOT/APPHOST/Default Web Site/sdata" overrideMode="Inherit" locked="false">
        <system.webServer-rewrite-rules>
            <rule name="crm72j_rule" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="crm72j/(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="([^:]+)(:[0-9]+)?" />
                </conditions>
                <serverVariables>
                </serverVariables>
                <action type="Rewrite" url="http://{C:1}:10009/crm72j/{R:1}" logRewrittenUrl="false" statusDescription="crm72j_rule" />
            </rule>
            <rule name="crm72SyncEngine_rule" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="crm72SyncEngine/(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="([^:]+)(:[0-9]+)?" />
                </conditions>
                <serverVariables>
                </serverVariables>
                <action type="Rewrite" url="http://{C:1}:10009/crm72SyncEngine/{R:1}" logRewrittenUrl="false" statusDescription="crm72SyncEngine_rule" />
            </rule>
            <rule name="crm72ExchangeSyncEngine_rule" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="crm72ExchangeSyncEngine/(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="([^:]+)(:[0-9]+)?" />
                </conditions>
                <serverVariables>
                </serverVariables>
                <action type="Rewrite" url="http://{C:1}:10009/crm72ExchangeSyncEngine/{R:1}" logRewrittenUrl="false" statusDescription="crm72ExchangeSyncEngine_rule" />
            </rule>
            <rule name="crm72SPSyncEngine_rule" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="crm72SPSyncEngine/(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="([^:]+)(:[0-9]+)?" />
                </conditions>
                <serverVariables>
                </serverVariables>
                <action type="Rewrite" url="http://{C:1}:10009/crm72SPSyncEngine/{R:1}" logRewrittenUrl="false" statusDescription="crm72SPSyncEngine_rule" />
            </rule>
            <rule name="crm72jspell_rule" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="crm72jspell/(.*)$" />
                <conditions logicalGrouping="MatchAny">
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="([^:]+)(:[0-9]+)?" />
                </conditions>
                <serverVariables>
                </serverVariables>
                <action type="Rewrite" url="http://{C:1}:10009/crm72jspell/{R:1}" logRewrittenUrl="false" statusDescription="crm72jspell_rule" />
            </rule>
        </system.webServer-rewrite-rules>
    </CONFIG>
</appcmd>

The file is also available for download here:

 Download: CRMRules

3: Once saved, you'll need to run the appcmd command to import the file. The location of appcmd may not be defined in your PATH environment variable - if this is the case, you can run the command from C:\Windows\System32\inetsrv. In the example below, I have saved CRMRules.xml to the root of my C drive.

appcmd set config -in < C:\CRMRules.xml

If successful, the following message will be displayed:

Applied configuration changes to section "system.webServer/rewrite/rules" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

The rules will then be visible in IIS, under Default Web Site\sdata\URL Rewrite.

More info:

Please note that this will only work when the ARR (Application Request Routing) module for IIS has already been installed on the machine. If you need to reinstall the module itself, you will find it on the v7.2 install media, in Sage\CRM\Utils\EN\UrlRewriter\.

* PowerShell also supportes remote management, though this is beyond the scope of this article.