Domanda

Qualcuno ha integrato ELMAH nel proprio ambiente SharePoint?

Suppongo sia possibile in quanto è tutto ASP.net, ma mi chiedevo solo se qualcuno lo avesse fatto e se ci fosse una spiegazione su come raggiungerlo?

È stato utile?

Soluzione

Usiamo ELMAH nel nostro ambiente MOSS 2007. Poiché ELMAH utilizza HttpHandlers ed è impostato tramite web.config, l'attivazione è stata un gioco da ragazzi. Aggiungi semplicemente le cose ELMAH a web.config per l'applicazione che stai eseguendo all'interno di SharePoint.

Se si desidera che ELMAH segnali errori a un livello superiore alla propria applicazione personalizzata, quindi aggiungerlo al web.config di SharePoint.

Altri suggerimenti

Una cosa che È importante quando si configura ELMAH o la maggior parte dei moduli HTTP in Sharepoint è che devono trovarsi all'inizio della sezione httpModules. Altrimenti SharePoint essenzialmente ingerirà l'eccezione e la funzionalità ELMAH non verrà invocata

Opere

<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....

Non funziona

<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"/>

Non c'è magia ad esso, basta collegarlo come faresti su qualsiasi altro sito ASP.NET.

Di seguito sono riportate le voci di configurazione che è necessario aggiungere in web.config dell'applicazione Web di SharePoint

Aggiungi in 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>

Aggiungi la sezione stringhe di connessione

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

</connectionStrings>

Aggiungi la sezione elmah proprio sotto la sezione stringhe

<elmah>

  <security allowRemoteAccess="0" />

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

Aggiungi la voce del gestore e del modulo nella sezione httphandlers e httpmodules in system.web

  <httpHandlers>

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

   </httpHandlers>

   <httpModules>

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

Aggiungi la voce gestore e modulo nella sezione gestori e moduli in 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>

Fare riferimento al link seguente per l'implementazione di elmah in sharepoint

http://sidteche.blogspot.in/ 2014/08 / implementare-ELMAH-custom-logging-in.html

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top