IIS 8.5 Rewrite module 2.0 not working - help badly needed!

Simona Cioroianu 0 Reputation points
2023-10-15T18:25:22.9566667+00:00

Long story short: the dev server got crashed, it was Server 2008 and IIS 7.0.Re-install IIS 8.5, on Server 2012. the re-write module is 2.0.

All rewrites for all sites are using FileMapProvider. No changes there, in the mappings files.
At first run, it gave me a simple 404. After messing with it, I am in the fatal 'HTTP Error 500.50 - URL Rewrite Module Error'

Still, not working and throwing "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Web.Iis.Rewrite.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies."

I spent last two days pulling my hair off, no resolve.The rewrite module works, because if I add a simple rule in IIS directly, is fine.

This my code in web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<providers>
<provider name="FileMapMainURLs" type="FileMapProvider, Microsoft.Web.Iis.Rewrite.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<settings>
<add key="FilePath" value="{DOCUMENT_ROOT}\App_Data\map-file-name.txt" />
<add key="IgnoreCase" value="1" />
<add key="Separator" value="|" />
</settings>
</provider>
</providers>
<rules>
<rule name="FileMapMainURLsRule" stopProcessing="true">
<match url="(.\*)" />
<conditions>
<add input="{FileMapMainURLs:{R:1}}" pattern="(.+)" />
</conditions>
<action type="Rewrite" url="{C:1}" />
</rule> ................................................

Many, many thanks in advance!

Internet Information Services
.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,988 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Lex Li (Microsoft) 5,662 Reputation points Microsoft Employee
    2023-10-16T02:10:44.04+00:00

    You are not supposed to use FileMapProvider as it was provided as part of the Extensibility Samples to show people how to write their own extensions to IIS URL Rewrite module,

    https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-custom-rewrite-providers-with-url-rewrite-module#using-filemapprovider

    That download is currently not available any more.

    If you want similar functionalities, you might follow this article and write some C# code to achieve the same,

    https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/developing-a-custom-rewrite-provider-for-url-rewrite-module


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.