IIS giving 0x8007000d "malformed XML" although the Web.config is valid

1

I am trying to use <system.webServer><rewrite> to enforce WWW but i keep getting the mentioned error "which indicates the xml is malformed" whenever I load the site. The error is raised from the whole <rewrite> block "surrounded by comments".

I tried online web.config validator and it didn't show any errors.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <!--Enfore WWW Problem Here-->
    <rewrite>
      <rules>
       <clear />
        <rule name="WWW Rewrite" enabled="true">
          <match url="(.*)" />
            <conditions>
              <add input="{HTTP_HOST}" negate="true" pattern="^www\.(.*)$" />
            </conditions>
            <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" appendQueryString="true" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
    <!--Enfore WWW Problem Here-->
  </system.webServer>
</configuration>
asp.net
asp.net-mvc
iis
url-rewriting
web-config
asked on Stack Overflow Feb 6, 2020 by Mina Gerges • edited Feb 6, 2020 by Mina Gerges

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0