简体   繁体   English

远程调试服务器

[英]asp.net Debug server remotely

I keep getting this when I try hit the link of a website I just deployed to the web host's server: 当我尝试点击刚部署到Web主机服务器的网站的链接时,我一直收到此消息:

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. 但是,可以由运行在本地服务器计算机上的浏览器查看它。

It Suggests I set the following in my web.config file so I can see details of the error: 建议我在web.config文件中设置以下内容,以便查看错误的详细信息:

The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL. 通过修改应用程序配置标签的“ defaultRedirect”属性以指向自定义错误页面URL,可以将当前看到的错误页面替换为自定义错误页面。

So I have added the following to my webconfig file and created a mycustompage.htm relative to the web.config file: 因此,我将以下内容添加到我的webconfig文件中,并相对于web.config文件创建了mycustompage.htm:

<configuration>
<system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>

My mycustompage.htm is empty, is there anything I should add in there? 我的mycustompage.htm为空,是否应该在其中添加任何内容? When I try hit the link now all I get is a blank page after the server tries to redirect to mycustompage.htm. 当我尝试点击链接时,服务器尝试将其重定向到mycustompage.htm之后,我得到的只是空白页。

Depending on what you're trying to accomplish: 根据您要完成的任务:

1) You want to view the actual error information. 1)您想查看实际的错误信息。

In this case, remove the defaultRedirect attribute and change mode to Off. 在这种情况下,请删除defaultRedirect属性并将模式更改为“关”。 Custom errors intercept the standard Yellow Screen of Death (YSOD) ASP.NET error page. 自定义错误会拦截标准的黄色死亡屏幕(YSOD)ASP.NET错误页面。 By setting Custom errors to Off, the YSOD error message will be visible to both local and remote clients (all remote users will see the error details). 通过将“自定义错误”设置为“关闭”,YSOD错误消息将对本地和远程客户端均可见(所有远程用户将看到错误详细信息)。

<configuration>
<system.web>
    <customErrors mode="Off" />
</system.web>
</configuration>

2) You want to build a custom error page to handle how your application responds to error conditions. 2)您想构建一个自定义错误页面来处理您的应用程序如何响应错误情况。

In this case, you might edit the mycustompage.htm to display a friendly "An error has occurred" message rather than seeing the default Custom Errors are not enabled message. 在这种情况下,您可以编辑mycustompage.htm以显示友好的“发生错误”消息,而不是看到默认的“未启用自定义错误”消息。

Link here for reference. 链接这里供参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM