title: Published web site does't recogonize the rewrite element in web.config
body: <p>All, I was stuck with a problem when I deploy a web site. I found there is an element named  <code>rewrite</code> in the web.config. </p>
  
  <pre><code>&lt;rewrite&gt;
          &lt;rules&gt;
              &lt;!-- below rule will abort api request when the request to pattern "apis/v.*" is of "http" method--&gt;
              &lt;rule name="AbortApiHTTPRequest"&gt;
                  &lt;!-- Note:
                          the below pattern is assumed that all apis conain prefix "apis/v", e.g. apis/v3/aaauth
                          if there are some exceptions for the assumption, below pattern needs to be updated.
                  --&gt;
                  &lt;match url="^apis/v.*$" /&gt;
                  &lt;conditions&gt;
                      &lt;add input="{HTTPS}" pattern="off" ignoreCase="true" /&gt;
                  &lt;/conditions&gt;
                  &lt;action type="AbortRequest" /&gt;
              &lt;/rule&gt;
  
              &lt;!-- below rule will redirect all non-https requests except for above requests to https request.--&gt;
              &lt;rule name="RedirectToHTTPS" stopProcessing="true"&gt;
                  &lt;match url="^.*$" /&gt;
                  &lt;conditions&gt;
                      &lt;add input="{HTTPS}" pattern="off" ignoreCase="true" /&gt;
                  &lt;/conditions&gt;
                  &lt;action type="Redirect" url="https://{SERVER_NAME}/{R:0}" redirectType="SeeOther" /&gt;
              &lt;/rule&gt;
          &lt;/rules&gt;
      &lt;/rewrite&gt;
  </code></pre>
  
  <p>When I remove the element everthing is ok, the website works well. Otherwise I got a error says.</p>
  
  <blockquote>
    <p>HTTP Error 500.19 - Internal Server Error The requested page cannot be
    accessed because the related configuration data for the page is
    invalid.</p>
  </blockquote>
  
  <p>After I did some research, I found this <a href="https://stackoverflow.com/questions/9280803/element-system-webserver-has-invalid-child-element-rewrite-should-i-fix-thi">question</a> talking about it. I am not sure if it is the cause of the problem. seems it is just a xml syntax validation of <code>Visual studio</code>. Does it really matter with the deployment of web site in IIS 7?</p>
  
  <p>Anyway, I also followed the instructions of the post , But I failed to get it works .even I run the <code>cmd</code> as the administrator. the error says below.</p>
  
  <blockquote>
    <p>Failed to open file Xml\Schemas\DotNetConfig.xsd. Make sure that the
    script is run in the elevated command prompt.</p>
  </blockquote>
  
  <p>I wandered if I have the enough previlige to run <code>cscript</code> command ? thanks.</p>
  
  <p><strong>More</strong></p>
  
  <p>If I run the project in the Visual Studio with the <code>Asp.net development server</code>, It can work without any error. But If I published the project to the IIS in my computer.  It doen't work. </p>