如何让IIS7显示ASP错误的详细信息

by 曾经沧海
1.1k 阅读

在网站目录下建立web.config文件,内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
</configuration>

这样就可以重新显示详细信息了。在Godaddy的虚拟主机上测试可行。

原文如下:

地址:http://internetoptimizers.com/2010/01/24/classic-asp-using-iis7-error-handling-500-internal-server-error-godaddy/

Classic ASP using IIS7 – Error Handling – 500 Internal Server

Howdy All,

This is a common problem I see lots of people running into since GoDaddy upgraded from IIS 6 to IIS 7.  The below story is a similar situation that I had while trying to work on a Classic ASP web site hosted at GoDaddy. I have included the answer/fix below.
Original Story:  I am with godaddy for webhosting right now. The have me using IIS7.
When I run my ASP page I get the error :

Error 500 :There is a problem with the resource you are looking for,
and it cannot be displayed.

Basically, there is an error in my code, however, it doesn’t tell me
the line number the error was found on. After searching the web I
found out how to turn on the more detailed error reporting… but you
have to do it on the webserver. I don’t have access to the webserver.

After spending allot of time chatting with godaddy, they claim I can
turn this on in the web.config file. I know this can be turn on for
ASP.NET in the web.config file… but as far as I know, not classic
asp.

OK…. Here is the web.config file I use that gives you the old school error handling data:

Step 1.  Open a text document.

Step 2.  Insert this code:

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed"/>
        <asp scriptErrorSentToBrowser="true"/>
    </system.webServer>
</configuration>

Step 3.  Save the file as Web.Config

Step 4.  Upload the Web.Config file to your host web directory.

I hope this helps people avoid the few hours I was on the phone with GoDaddy technical support.  :)   Please let me know if this helps anyone out.

发表评论