服务器错误当ASPX运行 [英] Server Error When ASPX Run
问题描述
我有简单的 ASPX
code。当我运行 ASPX
页与本地服务器(Visual Studio开发服务器)一切工作正常。但是,当我在我的域中运行它,我得到下面的异常。
说明:服务器上出现应用程序错误。目前
此应用程序prevent自定义错误设置的细节
远程查看(出于安全原因)应用程序错误。
它可以,但是,可以通过在本地服务器上运行的浏览器查看
机。
详细信息:若要使此特定错误信息的细节是对远程计算机上查看,请创建一个标签
位于根目录下的web.config配置文件中
当前Web应用程序。这个标签应该再
的mode属性设置为关。<! - web.config配置文件 - ><结构>
<&的System.Web GT;
<的customErrors模式=关/>
< /system.web>
< /结构>
注意:你所看到的当前错误页可以用自定义错误页替换通过修改的的defaultRedirect属性
应用程序的配置标记指向自定义
错误页的URL。<! - web.config配置文件 - ><结构>
<&的System.Web GT;
<的customErrors模式=仅限远程的defaultRedirect =mycustompage.htm/>
< /system.web>
< /结构>
块引用>ASPX code:
< HTML的xmlns =http://www.w3.org/1999/xhtml>
<头=服务器>
<标题>< /标题>
< /头>
<身体GT;
<表ID =form1的=服务器>
< DIV>
< H1>我在网上和LT; / H1>
< / DIV>
< /表及GT;
< /身体GT;
< / HTML>
解决方案更改为这ypur web.config中,你会得到异常。
您也可以从同一个域中的应用程序浏览网页,然后将也看到了异常。<结构>
<&的System.Web GT;
<的customErrors模式=关/>
< /system.web>
< /结构>I have simple
aspx
code. When I run theaspx
page with local server(Visual Studio Development Server) all works fine. But when I run it on my domain I get the following exception.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 tag within a "web.config" configuration file located in the root directory of the current web application. This 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 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>
aspx code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <h1>I am online</h1> </div> </form> </body> </html>
解决方案Change to this in ypur web.config and you will get the exception. You could also browse the website from the same domain as the application and would then also see the exception.
<configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration>
这篇关于服务器错误当ASPX运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!