2

使用 asp.net 4.0,一直试图遵循这个:

http://msdn.microsoft.com/en-us/library/ms998306

还尝试使用 eventlogprovider 和邮件提供程序。安静。关于健康监测有什么我应该知道的吗,就像它在 4.0 中不起作用一样?

目前我的 web.config 看起来像这样:

<healthMonitoring  enabled="true" heartbeatInterval="600">
  <providers>
   <clear/>
   <add name="EmailErrorProvider"
 type="System.Web.Management.SimpleMailWebEventProvider"
 to="martin.camitz@gmail.com"
 from="donotreply@cocoin.com"
 buffer="false"
 subjectPrefix="An error has occured."
 bodyHeader="This email is generated from my application." />
   <add connectionStringName="MySqlConnection"
      maxEventDetailsLength="1073741823"
      buffer="true"
      bufferMode="Extra Critical Notification"
      name="MySqlWebEventProvider"
      type="System.Web.Management.SqlWebEventProvider,System.Web,Version=2.0.0 .0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
  </providers>
  <rules>
   <clear/>
   <add name="Testing Mail Event Providers"
 eventName="All Errors"
 provider="EmailErrorProvider"
 profile="Default"
 minInstances="1"
 maxLimit="Infinite"
 minInterval="00:01:00"
 custom=""/>
   <add name="Critical event"
     eventName="My Critical Event"
     provider="MySqlWebEventProvider"
     profile="Throttle"/>
  </rules>
  <eventMappings>
   <clear/>
   <add name="All Errors"
 type="System.Web.Management.WebBaseErrorEvent, System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"
 startEventCode="0"
 endEventCode="2147483647"/>
   <add name="My Critical Event"
     type="MyWebEvents.MyCriticalEvent,MyWebEvents"/>
  </eventMappings>
  <profiles>
   <add name="Throttle"
     minInstances="1"
     maxLimit="1000"
     minInterval="00:00:01"/>
  </profiles>
  <bufferModes>
   <add name="Extra Critical Notification"
     maxBufferSize="10"
     maxFlushSize="5"
     urgentFlushThreshold="1"
     regularFlushInterval="Infinite"
     urgentFlushInterval="00:01:00"
     maxBufferThreads="1"
    />
  </bufferModes>
 </healthMonitoring>

希望有人可以提供帮助。

4

1 回答 1

1

HealthMonitoring 在 4.0 中运行良好。

您可能尚未在 web.config 中定义 SMTP 服务器

如果您不能使用本地 SMTP 服务器并且只能通过主机/IP/用户名/密码发送邮件,您可以查看这篇文章:http ://www.tomot.de/en-us/article/6/ asp.net/how-to-create-a-custom-healthmonitoring-provider-that-sends-e-mails

于 2011-02-26T19:23:38.090 回答