【问题标题】:Internal Server Error 500. web.config内部服务器错误 500.web.config
【发布时间】:2023-03-15 11:24:02
【问题描述】:

我收到此错误:500 内部服务器错误 我的contact.aspx文件中有一个验证码,在web.config中我有一行代码(),如果我删除这一行,页面运行正常,但验证码图像没有显示。!任何人都可以帮忙。这是 web.config 中的代码:

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
<system.web>
    <httpHandlers>
      <add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler,MSCaptcha"/>
    </httpHandlers>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration>

【问题讨论】:

  • 我要做的第一件事是尝试启用调试,看看除了“500 错误”之外,它是否能提供更多信息。
  • 您的应用程序池是经典模式还是集成模式?

标签: asp.net


【解决方案1】:

您可能在集成模式下运行,在这种情况下,您必须在另一个部分中注册您的处理程序,例如:

<configuration>
  <system.webServer>
    <handlers>
<add name="CaptchaImageHandler" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha" />
    </handlers>
  </system.webServer>
</configuration>

并记得删除 httpHandlers 部分中存在的当前处理程序定义。

【讨论】:

    【解决方案2】:

    我找到了答案。 正确的代码应该是这样的:

    <configuration>
      <system.web>
            ....
      </system.web>
      <system.webServer>
        <handlers>
    <add name="CAPTCHAHandler" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha" />
        </handlers>
      </system.webServer>
    </configuration>

    【讨论】:

      猜你喜欢
      • 2012-03-29
      • 2012-10-12
      • 2015-11-25
      • 2019-01-17
      • 2011-10-17
      • 2010-11-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多