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