不幸的是,这是不可能的。您可以使用事件日志查看详细信息,也可以通过电子邮件向自己发送错误详细信息:
<healthMonitoring enabled="true" heartbeatInterval="0">
<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" />
</eventMappings>
<providers>
<clear />
<add name="EmailProvider" type="System.Web.Management.SimpleMailWebEventProvider" to="youemail@example.com" from="webserver@example.com" buffer="true" bufferMode="Logging" />
<add name="EventLogProvider" type="System.Web.Management.EventLogWebEventProvider" />
</providers>
<rules>
<clear />
<add name="EmailRule" eventName="All Errors" provider="EmailProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" />
<add name="EventLogRule" eventName="All Errors" provider="EventLogProvider" profile="Default" minInstances="1" maxLimit="Infinite" minInterval="00:01:00" />
</rules>
</healthMonitoring>
如果您只想每小时或每天接收通知,请调整 minInterval。当然,请确保您已为您的网络服务器配置了电子邮件。例如
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:\MailPickUpFolders\ExampleDomain" />
<network host="localhost" port="25" />
</smtp>
<!--<smtp deliveryMethod="Network">
<network host="yoursever" port="25" />
</smtp>-->
</mailSettings>
</system.net>