Elmah 不在现场工作

发布于 2024-11-12 03:42:40 字数 2249 浏览 0 评论 0原文

我将 elmah 与 asp.net mvc 3 站点一起使用,它在本地工作正常,但是当我将其上传到我的共享托管站点(iis 7)时,它似乎没有记录任何错误。

我使用 nuget 来获取该库,并且假设它在 web.config 中设置了它需要的所有内容。

所以我不知道我错过了什么以及为什么它没有出现。

编辑

这里是我拥有的一切

    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
          <elmah xdt:Transform="Replace">
            <errorMail from=""
                   to=""
                   cc=""
                   subject=""
                   async="true"
                   smtpPort="26"
                   smtpServer=""
                   userName=""
                   password="" />
            <errorLog type="Elmah.SqlErrorLog, Elmah" logPath="~/App_Data" connectionStringName="ConnectionString" />
            <errorFilter>
          <test>
            <equal binding="HttpStatusCode" value="404" type="Int32" />
          </test>
        </errorFilter>
        <security allowRemoteAccess="0" />
      </elmah>
    </configuration>
  <system.web>
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
    <httpHandlers>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
  </system.web>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
      <modules runAllManagedModulesForAllRequests="true">
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
      </modules>
      <handlers>
          <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
      </handlers>
  </system.webServer>

I am using elmah with an asp.net mvc 3 site and it works fine locally but when I upload it to my shared hosting site(iis 7) it does not seem to log any of the errors.

I used nuget to grab the library and I was under the assumption that it set up all the stuff in the web.config that it needs.

So I have no clue what I am missing and why it does not show up.

Edit

here is everything elmah I have

    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
          <elmah xdt:Transform="Replace">
            <errorMail from=""
                   to=""
                   cc=""
                   subject=""
                   async="true"
                   smtpPort="26"
                   smtpServer=""
                   userName=""
                   password="" />
            <errorLog type="Elmah.SqlErrorLog, Elmah" logPath="~/App_Data" connectionStringName="ConnectionString" />
            <errorFilter>
          <test>
            <equal binding="HttpStatusCode" value="404" type="Int32" />
          </test>
        </errorFilter>
        <security allowRemoteAccess="0" />
      </elmah>
    </configuration>
  <system.web>
    <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
    <httpHandlers>
      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
    </httpHandlers>
  </system.web>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
      <modules runAllManagedModulesForAllRequests="true">
          <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
          <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
      </modules>
      <handlers>
          <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
      </handlers>
  </system.webServer>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪眸﹌ 2024-11-19 03:42:40

如果您使用 NuGet 下载了它,您应该准备好所有配置部分。
无论如何,请尝试检查您的 system.webServer 部分:

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    </modules>
    <handlers>
      <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
  </system.webServer>

if you have downloaded it with NuGet you should have all the config sections ready.
Anyway, Try and check your system.webServer section:

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    </modules>
    <handlers>
      <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
    </handlers>
  </system.webServer>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文