« Previous Next »

Thread: Error parsing rewrite rules in configSource file - why?

Last post 02-22-2009 9:30 AM by mmsaffari. 9 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (10 items)

Sort Posts:

  • 02-13-2009, 4:59 PM

    Error parsing rewrite rules in configSource file - why?

    Trying to figure out why we get this 500 error: 

    Specified configSource cannot be parsed

     From this entry in web.config

    <rewriteMaps configSource="/upload/rewritemaps.config" />

    pointing to this file upload/rewritemaps.config with this file content:

    <rewriteMap name="TestRewriteMap">

    <add key="/Web-Sites" value="/WebSites.aspx" />

    </rewriteMap>

     

     

  • 02-13-2009, 5:06 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Error parsing rewrite rules in configSource file - why?

    Have you tried using relative path in the configSource, e.g. remove the first slash?

    http://ruslany.net
  • 02-13-2009, 5:23 PM In reply to

    Re: Error parsing rewrite rules in configSource file - why?

    Get the exact same error if changed to:

    <rewriteMaps configSource="upload/rewritemaps.config" />

  • 02-13-2009, 5:31 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Error parsing rewrite rules in configSource file - why?

    I think you need to add <rewriteMaps> at the beginning and </rewriteMaps> at the end of the rewritemaps.config file, e.g.

    <rewriteMaps>
    <
    rewriteMap name="TestRewriteMap">
    <
    add key="/Web-Sites" value="/WebSites.aspx" />
    </
    rewriteMap>
    </rewriteMaps>

    Refer to this thread for more details: http://forums.iis.net/t/1150604.aspx

    http://ruslany.net
  • 02-13-2009, 5:48 PM In reply to

    Re: Error parsing rewrite rules in configSource file - why?

    That gets ride of the error if I put the rewritemaps.config file in the same directory as the web.config file.  Thanks

    But now I need to figure out the correct syntax for putting rewritemaps.config file into a sub-directory:

    <rewriteMaps configSource="upload/rewritemaps.config" />  <-- does not work

    <rewriteMaps configSource="/upload/rewritemaps.config" />  <-- does not work

    <rewriteMaps configSource="~/upload/rewritemaps.config" />  <- does not work

  • 02-14-2009, 5:09 AM In reply to

    • DarkMaster
    • Top 500 Contributor
    • Joined on 07-06-2006, 9:05 AM
    • Murska Sobota, Slovenia
    • Posts 19

    Re: Error parsing rewrite rules in configSource file - why?

    I have learned from experience that including the rewriteMaps from other then root of the site does not work - I tried also as you to include the rewriteMap from a folder(for better manageability) but that was a no-go. Do it from the site's root...

    Who are you? What do you want?
  • 02-16-2009, 12:33 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: Error parsing rewrite rules in configSource file - why?

    Does it work if you specify configSource="upload\rewritemaps.config" (note the \ instead of a /)

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 02-16-2009, 1:58 PM In reply to

    Re: Error parsing rewrite rules in configSource file - why?

    Yes your suggestion works.

                <rewriteMaps configSource="upload\rewritemaps.config"/>

    with "upload\rewritemaps.config" instead of "upload/rewritemaps.config"

    Thank you.

  • 02-17-2009, 4:30 AM In reply to

    • DarkMaster
    • Top 500 Contributor
    • Joined on 07-06-2006, 9:05 AM
    • Murska Sobota, Slovenia
    • Posts 19

    Re: Error parsing rewrite rules in configSource file - why?

    Sweet! I did not remember about that...I will implement it right away. Thank you anilr!

    Who are you? What do you want?
  • 02-22-2009, 9:30 AM In reply to

    Re: Error parsing rewrite rules in configSource file - why?

    I know the issue is solved, but ppl, please read the error messages throughly. It's exactly as anilr wrote because the path for configSource has to be "PHYSICAL" and relative.

     This means the ".config" files should be stored somewhere under the Application path and you have to refer them by their relative physical path and therefore segments of path would be joined by a BACKSLASH and not a forward one.

     

Page 1 of 1 (10 items)
Microsoft Communities