【发布时间】:2015-05-12 08:49:58
【问题描述】:
最近,我将一个在 VS2013 中构建的 MVC 站点部署到 Azure。事实上,到目前为止,我已经完成了 4 次部署。第一棵树部署成功。
当我收到一条错误消息时,这是上次部署:需要在 web.config 中添加标签。
这很奇怪,因为在本地测试 git 时我没有收到任何错误。直到,我将它部署到 Azure。
这是我在 Azure 中运行时遇到的错误:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
我在上次部署中所做的更改是使用第一个代码创建方法添加一些列,以及数据迁移本身。
同样,本地一切正常。但是,一旦它在 Azure 中就不会了。
任何线索,helo,方法?
【问题讨论】:
-
您能否详细说明您收到的错误消息?
-
您可能有一个未处理的异常,可能是由于数据库连接字符串不正确(这就是为什么它可以在本地工作,但不是在部署时)。您看到的屏幕告诉您可以更新 web.config 的
<customErrors />部分以查看实际错误是什么。虽然您可以暂时执行此操作以在 Azure 上查看问题,但不建议将其用于实时站点。
标签: c# asp.net-mvc asp.net-mvc-4 azure