/
TemplatedMailWebEventProvider.xml
200 lines (181 loc) · 10.7 KB
/
TemplatedMailWebEventProvider.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<Type Name="TemplatedMailWebEventProvider" FullName="System.Web.Management.TemplatedMailWebEventProvider">
<TypeSignature Language="C#" Value="public sealed class TemplatedMailWebEventProvider : System.Web.Management.MailWebEventProvider" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit TemplatedMailWebEventProvider extends System.Web.Management.MailWebEventProvider" />
<TypeSignature Language="DocId" Value="T:System.Web.Management.TemplatedMailWebEventProvider" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class TemplatedMailWebEventProvider
Inherits MailWebEventProvider" />
<TypeSignature Language="F#" Value="type TemplatedMailWebEventProvider = class
 inherit MailWebEventProvider" />
<TypeSignature Language="C++ CLI" Value="public ref class TemplatedMailWebEventProvider sealed : System::Web::Management::MailWebEventProvider" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Web.Management.MailWebEventProvider</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Implements an event provider that uses templates to define and format emails it sends for event notifications.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
ASP.NET health monitoring allows production and operations staff to manage deployed Web applications. The <xref:System.Web.Management?displayProperty=nameWithType> namespace contains the health event types responsible for packaging application health-status data and the provider types responsible for processing this data. It also contains supporting types that help during the management of health events.
This class is not intended to be used from your code. It is created, configured, and used by the ASP.NET health-monitoring system to send event notifications by email. You can define an email Web event provider in a configuration file, as demonstrated in the Example section of this topic. In addition, you can configure the providers section programmatically by accessing the <xref:System.Web.Configuration.HealthMonitoringSection.Providers%2A?displayProperty=nameWithType> property.
The email this class produces is defined and formatted using a template. This template consists of markup code defined in a standard .aspx file that outputs the text for the message body. The event information used by the template is provided by a <xref:System.Web.Management.MailEventNotificationInfo> object that is available from the static <xref:System.Web.Management.TemplatedMailWebEventProvider.CurrentNotification%2A> property of this class.
This provider has a comprehensive set of configuration attributes that you can use to customize the way it works.
## Examples
The following example is a configuration file excerpt that shows how to specify a provider of type <xref:System.Web.Management.SimpleMailWebEventProvider> in the `<healthMonitoring>` section The `<add>` elements in the `<rules>` section specify that the provider will handle request-processing errors and infrastructure errors.
```
<system.web>
<healthMonitoring
enabled="true"
heartBeatInterval="0">
<bufferModes>
<add name="Critical Notification"
maxBufferSize="100"
maxFlushSize="20"
urgentFlushThreshold="1"
regularFlushInterval="Infinite"
urgentFlushInterval="00:01:00"
maxBufferThreads="1"
/>
</bufferModes>
<providers>
<add name="CriticalMailEventProvider"
type="System.Web.Management.TemplatedMailWebEventProvider,
System.Web, Version=%ASSEMBLY_VERSION%, Culture=neutral,
PublicKeyToken=%MICROSOFT_PUBLICKEY%"
template="../mailtemplates/critical.aspx"
from="sender address"
to="someone@example.com"
cc="someone@example.com"
bcc="someone@example.com"
priority="High"
bodyHeader="Warning!"
bodyFooter="Please investigate ASAP."
subjectPrefix="Action required."
buffer="true"
bufferMode="Critical Notification"
maxEventLength="4096"
maxSize="4096"
maxMessagesPerNotification="1"
/>
</providers>
<eventMappings>
<add name="Request Processing Events"
type="System.Web.Management.WebRequestEvent, System.Web",
Version=%ASSEMBLY_VERSION%, Culture=neutral,
PublicKeyToken=%MICROSOFT_PUBLICKEY%"
/>
<add name="Infrastructure Errors"
type="System.Web.Management.WebErrorEvent, System.Web,
Version=%ASSEMBLY_VERSION%, Culture=neutral,
PublicKeyToken=%MICROSOFT_PUBLICKEY%"
/>
</eventMappings>
<profiles>
<add name="Default"
minInstances="1"
maxLimit="Infinite"
minInterval="00:10:00"
/>
<add name="Critical"
minInstances="1"
maxLimit="1024"
minInterval="00:00:00"
/>
</profiles>
<rules>
<add name="Request Processing Errors"
eventName="Request Processing Errors"
provider="CriticalMailEventProvider"
profile="Default"
/>
<add name="Infrastructure Notifications"
eventName="Infrastructure Errors"
provider="CriticalMailEventProvider"
profile="Critical"
/>
</rules>
</healthMonitoring>
</system.web>
```
]]></format>
</remarks>
<altmember cref="T:System.Web.Management.WebEventProvider" />
<altmember cref="T:System.Web.Configuration.HealthMonitoringSection" />
<altmember cref="T:System.Web.Management.MailWebEventProvider" />
<altmember cref="T:System.Web.Management.MailEventNotificationInfo" />
<related type="Article" href="https://msdn.microsoft.com/library/ab894e83-7e2f-4af8-a116-b1bff8f815b2">Installing and Configuring ASP.NET Providers</related>
</Docs>
<Members>
<Member MemberName="CurrentNotification">
<MemberSignature Language="C#" Value="public static System.Web.Management.MailEventNotificationInfo CurrentNotification { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Web.Management.MailEventNotificationInfo CurrentNotification" />
<MemberSignature Language="DocId" Value="P:System.Web.Management.TemplatedMailWebEventProvider.CurrentNotification" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property CurrentNotification As MailEventNotificationInfo" />
<MemberSignature Language="F#" Value="static member CurrentNotification : System.Web.Management.MailEventNotificationInfo" Usage="System.Web.Management.TemplatedMailWebEventProvider.CurrentNotification" />
<MemberSignature Language="C++ CLI" Value="public:
 static property System::Web::Management::MailEventNotificationInfo ^ CurrentNotification { System::Web::Management::MailEventNotificationInfo ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Web.Management.MailEventNotificationInfo</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the event notification object that provides the event information used by the email template.</summary>
<value>The <see cref="T:System.Web.Management.MailEventNotificationInfo" /> object currently being processed.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The current <xref:System.Web.Management.MailEventNotificationInfo> object is used within the email template to provide information about the events being processed.
]]></format>
</remarks>
<altmember cref="T:System.Web.Management.MailEventNotificationInfo" />
</Docs>
</Member>
<Member MemberName="Initialize">
<MemberSignature Language="C#" Value="public override void Initialize (string name, System.Collections.Specialized.NameValueCollection config);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void Initialize(string name, class System.Collections.Specialized.NameValueCollection config) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.Management.TemplatedMailWebEventProvider.Initialize(System.String,System.Collections.Specialized.NameValueCollection)" />
<MemberSignature Language="VB.NET" Value="Public Overrides Sub Initialize (name As String, config As NameValueCollection)" />
<MemberSignature Language="F#" Value="override this.Initialize : string * System.Collections.Specialized.NameValueCollection -> unit" Usage="templatedMailWebEventProvider.Initialize (name, config)" />
<MemberSignature Language="C++ CLI" Value="public:
 override void Initialize(System::String ^ name, System::Collections::Specialized::NameValueCollection ^ config);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="config" Type="System.Collections.Specialized.NameValueCollection" />
</Parameters>
<Docs>
<param name="name">The name of this event provider.</param>
<param name="config">A <see cref="T:System.Collections.Specialized.NameValueCollection" /> object that specifies configuration settings for this event provider.</param>
<summary>Sets the initial values for this object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is not intended to be used directly from your code. It is called by the ASP.NET health-monitoring system.
]]></format>
</remarks>
<exception cref="T:System.Configuration.ConfigurationErrorsException">
<paramref name="config" /> does not include an attribute with the name "template".
-or-
The template attribute supplied by <paramref name="config" /> has a <see cref="P:System.String.Length" /> of <see langword="0" />.
-or-
The URL specified by the template attribute is not an application-relative URL.
-or-
The specified template URL is outside the App Domain Path.</exception>
</Docs>
</Member>
</Members>
</Type>