是否有人将 ELMAH 整合到他们的SharePoint环境中?

我认为这是可能的,因为它是所有的ASP.net,但我只是想知道是否有人这样做了,如果有一个如何实现它?

有帮助吗?

解决方案

我们在MOSS 2007环境中使用ELMAH。由于ELMAH使用HttpHandlers并通过web.config设置,因此激活它很简单。只需将ELMAH内容添加到您在SharePoint中运行的应用程序的web.config中。

如果您希望ELMAH报告的错误级别高于自定义应用程序,请将其添加到SharePoint web.config。

其他提示

在设置ELMAH或者Sharepoint中的大多数HTTPModule时,重要的一点是它们需要位于httpModules部分的开头。否则,SharePoint将基本上吞下异常,并且不会调用ELMAH功能

<强>作品

<clear />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>  
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
     ... Rest of SharePoint modules....

不起作用

<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
     ... Rest of SharePoint modules....
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>  
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>

没有任何魔力,只需像在其他任何ASP.NET站点上一样连接它。

以下是需要在SharePoint Web应用程序的web.config中添加的配置条目

在configsection下添加

 <configSections>
    <sectionGroup name="elmah">

    <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />

    <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />

    <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />

    <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />

    </sectionGroup>
 </configSections>

添加连接字符串部分

<connectionStrings>
 <add name="elmah-express" connectionString="Data Source=[server name];Initial Catalog=  [ELMAH_customlogging];User ID=testuser;Password=Welcome1;" />

</connectionStrings>

在connectionstring部分

下面添加elmah部分
<elmah>

  <security allowRemoteAccess="0" />

  <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-express" />
</elmah>

在httpsndlers和system.web

下的httpmodules部分添加处理程序和模块条目
  <httpHandlers>

      <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>

   </httpHandlers>

   <httpModules>

      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
    </httpModules>

在system.webserver

下的处理程序和模块部分中添加处理程序和模块条目
    <modules runAllManagedModulesForAllRequests="true">

    <remove name="ErrorLog"/>

     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />

     <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />

     <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />

     <add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
     </modules>

     <handlers>

     <add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />

     </handlers>

请参阅以下链接,了解在sharepoint中的elmah实施

http://sidteche.blogspot.in/ 2014/08 /工具 - ELMAH-定制测井in.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top