display detailed error message on IIS 7.5

那年仲夏 提交于 2019-12-29 09:10:10

问题


I'm trying to display detailed error message on a page using web.config on my remote server on hostgator running IIS 7.5. I've tried almost everything but can't get it to work.

<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" existingResponse="PassThrough" />
  </system.webServer>
</configuration>

When i preview the page i get this error.

An error occurred on the server when processing the URL. Please contact the 
system administrator.

If you are the system administrator please click here to find out more about 
this error.

回答1:


Perhaps other way to get detailed information (sorry, this is for IIS 8.5)

See sample of 500.asp page in me comment above




回答2:


What you have is correct but you also need to tell the Classic ASP handler to send errors to the browser or the default

An error occurred on the server when processing the URL. Please contact the 
system administrator.

If you are the system administrator please click here to find out more about 
this error.

will be sent.

To do this you just need to override the current ASP configuration by updating the web.config file, something like;

<configuration>
  <system.webServer>
    <httpErrors errorMode="Detailed" existingResponse="PassThrough" />
    <asp scriptErrorSentToBrowser="True" />
  </system.webServer>
</configuration>

Because of the cool way IIS Configuration inheritance works this should override the default value of False in applicationHosts.config with the value defined in the site specific web.config file.

It's worth noting that in some budget / shared hosting environments where you have no access to server configuration you may have problems setting certain configuration values, because the owner (Hosting Company etc) has configured the applicationHosts.config section with a value of overrideModeDefault="Deny" locking a section from having configuration values overridden at the web application level.


Useful Links

  • Configuration Reference - system.webServer - ASP (Details attributes and childNodes that can be configured in the web.config file)
  • How to Use Locking in IIS 7.0 Configuration (An insight into how configuration is affected by locking at higher levels)
  • Delegating Configuration in IIS 7.0 (Shows how configuration can be delegated to site owners)
  • Delegating errorMode in httpErrors (This article is specific to your particular problem but might help shine some light on the problem)


来源:https://stackoverflow.com/questions/29583791/display-detailed-error-message-on-iis-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!