我已經建立了ASP.Net健康監測在web.config中:訪問HealthMonitoring提供者設定編程
<healthMonitoring enabled="true">
<providers>
<clear />
<add name="CriticalMailEventProvider" type="System.Web.Management.SimpleMailWebEventProvider"
from="[email protected]" to="[email protected]"
bodyHeader="Application Error!" bodyFooter="Please investigate ASAP."
subjectPrefix="ERROR: " buffer="true" bufferMode="Critical Notification"
maxEventLength="8192" maxMessagesPerNotification="1"
/>
</providers></healthMonitoring>
而且我試圖讀取該供應商的配置代碼:
Dim HealthMonitoring As System.Web.Configuration.HealthMonitoringSection
Dim ToAddress As String
HealthMonitoring = CType(WebConfigurationManager.GetWebApplicationSection("system.web/healthMonitoring"), HealthMonitoringSection)
ToAddress = HealthMonitoring.Providers(0).ElementInformation.Properties("to").Value.ToString
[注意:不是實際的產品代碼,爲了簡明起見硬編碼&]
問題:儘管ElementInformation.Properties集合包含如預期的那樣,值是「Nothing」,「Properties(」to「)」的所有其他屬性也是如此。
如何訪問提供程序的設置?
anysolution,任何樣品完整的代碼? – Kiquenet 2011-01-24 15:45:48