【发布时间】:2013-08-17 08:20:17
【问题描述】:
所有,我在部署网站时遇到了一个问题。我发现 web.config 中有一个名为 rewrite 的元素。
<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>
当我删除元素时一切正常,网站运行良好。否则我得到一个错误说。
HTTP 错误 500.19 - 内部服务器错误 无法访问请求的页面 访问,因为该页面的相关配置数据是 无效。
在我做了一些研究之后,我发现这个question 正在谈论它。我不确定这是否是问题的原因。似乎这只是Visual studio 的xml 语法验证。在 IIS 7 中部署网站真的很重要吗?
无论如何,我也按照帖子的说明进行操作,但我未能使其正常工作。即使我以管理员身份运行cmd。错误如下所示。
无法打开文件 Xml\Schemas\DotNetConfig.xsd。确保 脚本在提升的命令提示符下运行。
如果我有足够的权限运行cscript 命令,我会徘徊吗?谢谢。
更多
如果我在 Visual Studio 中使用 Asp.net development server 运行项目,它可以正常工作而不会出现任何错误。但是,如果我将项目发布到计算机中的 IIS。它不起作用。
【问题讨论】:
-
如果您在本地访问网站(即与 IIS 服务在同一台机器上),您会得到扩展的错误信息吗?
-
是的,我在我的电脑的IIS中发布了它,并在我的电脑中访问它,完整的错误信息可以显示在页面中。
标签: asp.net asp.net-mvc-4