2 // System.Web.Configuration.ProcessModelSection
5 // Chris Toshok (toshok@ximian.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
33 using System.Configuration;
37 namespace System.Web.Configuration {
39 public sealed class ProcessModelSection : ConfigurationSection
41 static ConfigurationProperty autoConfigProp;
42 static ConfigurationProperty clientConnectedCheckProp;
43 static ConfigurationProperty comAuthenticationLevelProp;
44 static ConfigurationProperty comImpersonationLevelProp;
45 static ConfigurationProperty cpuMaskProp;
46 static ConfigurationProperty enableProp;
47 static ConfigurationProperty idleTimeoutProp;
48 static ConfigurationProperty logLevelProp;
49 static ConfigurationProperty maxAppDomainsProp;
50 static ConfigurationProperty maxIoThreadsProp;
51 static ConfigurationProperty maxWorkerThreadsProp;
52 static ConfigurationProperty memoryLimitProp;
53 static ConfigurationProperty minIoThreadsProp;
54 static ConfigurationProperty minWorkerThreadsProp;
55 static ConfigurationProperty passwordProp;
56 static ConfigurationProperty pingFrequencyProp;
57 static ConfigurationProperty pingTimeoutProp;
58 static ConfigurationProperty requestLimitProp;
59 static ConfigurationProperty requestQueueLimitProp;
60 static ConfigurationProperty responseDeadlockIntervalProp;
61 static ConfigurationProperty responseRestartDeadlockIntervalProp;
62 static ConfigurationProperty restartQueueLimitProp;
63 static ConfigurationProperty serverErrorMessageFileProp;
64 static ConfigurationProperty shutdownTimeoutProp;
65 static ConfigurationProperty timeoutProp;
66 static ConfigurationProperty userNameProp;
67 static ConfigurationProperty webGardenProp;
68 static ConfigurationPropertyCollection properties;
70 static ConfigurationElementProperty elementProperty;
72 static ProcessModelSection ()
74 autoConfigProp = new ConfigurationProperty ("autoConfig", typeof (bool), false);
75 clientConnectedCheckProp = new ConfigurationProperty ("clientConnectedCheck", typeof (TimeSpan), TimeSpan.FromSeconds (5),
76 PropertyHelper.InfiniteTimeSpanConverter,
77 PropertyHelper.DefaultValidator,
78 ConfigurationPropertyOptions.None);
79 comAuthenticationLevelProp = new ConfigurationProperty ("comAuthenticationLevel", typeof (ProcessModelComAuthenticationLevel), ProcessModelComAuthenticationLevel.Connect,
80 new GenericEnumConverter (typeof (ProcessModelComAuthenticationLevel)),
81 PropertyHelper.DefaultValidator,
82 ConfigurationPropertyOptions.None);
83 comImpersonationLevelProp = new ConfigurationProperty ("comImpersonationLevel", typeof (ProcessModelComImpersonationLevel), ProcessModelComImpersonationLevel.Impersonate,
84 new GenericEnumConverter (typeof (ProcessModelComImpersonationLevel)),
85 PropertyHelper.DefaultValidator,
86 ConfigurationPropertyOptions.None);
87 cpuMaskProp = new ConfigurationProperty ("cpuMask", typeof (int), 0xffffffff);
88 enableProp = new ConfigurationProperty ("enable", typeof (bool), true);
89 idleTimeoutProp = new ConfigurationProperty ("idleTimeout", typeof (TimeSpan), TimeSpan.MaxValue,
90 PropertyHelper.InfiniteTimeSpanConverter,
91 PropertyHelper.DefaultValidator,
92 ConfigurationPropertyOptions.None);
93 logLevelProp = new ConfigurationProperty ("logLevel", typeof (ProcessModelLogLevel), ProcessModelLogLevel.Errors,
94 new GenericEnumConverter (typeof (ProcessModelLogLevel)),
95 PropertyHelper.DefaultValidator,
96 ConfigurationPropertyOptions.None);
97 maxAppDomainsProp = new ConfigurationProperty ("maxAppDomains", typeof (int), 2000,
98 TypeDescriptor.GetConverter (typeof (int)),
99 PropertyHelper.IntFromOneToMax_1Validator,
100 ConfigurationPropertyOptions.None);
101 maxIoThreadsProp = new ConfigurationProperty ("maxIoThreads", typeof (int), 20,
102 TypeDescriptor.GetConverter (typeof (int)),
103 PropertyHelper.IntFromOneToMax_1Validator,
104 ConfigurationPropertyOptions.None);
105 maxWorkerThreadsProp = new ConfigurationProperty ("maxWorkerThreads", typeof (int), 20,
106 TypeDescriptor.GetConverter (typeof (int)),
107 PropertyHelper.IntFromOneToMax_1Validator,
108 ConfigurationPropertyOptions.None);
109 memoryLimitProp = new ConfigurationProperty ("memoryLimit", typeof (int), 60);
110 minIoThreadsProp = new ConfigurationProperty ("minIoThreads", typeof (int), 1,
111 TypeDescriptor.GetConverter (typeof (int)),
112 PropertyHelper.IntFromOneToMax_1Validator,
113 ConfigurationPropertyOptions.None);
114 minWorkerThreadsProp = new ConfigurationProperty ("minWorkerThreads", typeof (int), 1,
115 TypeDescriptor.GetConverter (typeof (int)),
116 PropertyHelper.IntFromOneToMax_1Validator,
117 ConfigurationPropertyOptions.None);
118 passwordProp = new ConfigurationProperty ("password", typeof (string), "AutoGenerate");
119 pingFrequencyProp = new ConfigurationProperty ("pingFrequency", typeof (TimeSpan), TimeSpan.MaxValue,
120 PropertyHelper.InfiniteTimeSpanConverter,
121 PropertyHelper.DefaultValidator,
122 ConfigurationPropertyOptions.None);
123 pingTimeoutProp = new ConfigurationProperty ("pingTimeout", typeof (TimeSpan), TimeSpan.MaxValue,
124 PropertyHelper.InfiniteTimeSpanConverter,
125 PropertyHelper.DefaultValidator,
126 ConfigurationPropertyOptions.None);
127 requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), Int32.MaxValue,
128 PropertyHelper.InfiniteIntConverter,
129 PropertyHelper.IntFromZeroToMaxValidator,
130 ConfigurationPropertyOptions.None);
131 requestQueueLimitProp = new ConfigurationProperty ("requestQueueLimit", typeof (int), 5000,
132 PropertyHelper.InfiniteIntConverter,
133 PropertyHelper.IntFromZeroToMaxValidator,
134 ConfigurationPropertyOptions.None);
135 responseDeadlockIntervalProp = new ConfigurationProperty ("responseDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3),
136 PropertyHelper.InfiniteTimeSpanConverter,
137 PropertyHelper.PositiveTimeSpanValidator,
138 ConfigurationPropertyOptions.None);
139 responseRestartDeadlockIntervalProp = new ConfigurationProperty ("responseRestartDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3),
140 PropertyHelper.InfiniteTimeSpanConverter,
141 PropertyHelper.DefaultValidator,
142 ConfigurationPropertyOptions.None);
143 restartQueueLimitProp = new ConfigurationProperty ("restartQueueLimit", typeof (int), 10,
144 PropertyHelper.InfiniteIntConverter,
145 PropertyHelper.IntFromZeroToMaxValidator,
146 ConfigurationPropertyOptions.None);
147 serverErrorMessageFileProp = new ConfigurationProperty ("serverErrorMessageFile", typeof (string), "");
148 shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (5),
149 PropertyHelper.InfiniteTimeSpanConverter,
150 PropertyHelper.PositiveTimeSpanValidator,
151 ConfigurationPropertyOptions.None);
152 timeoutProp = new ConfigurationProperty ("timeout", typeof (TimeSpan), TimeSpan.MaxValue,
153 PropertyHelper.InfiniteTimeSpanConverter,
154 PropertyHelper.DefaultValidator,
155 ConfigurationPropertyOptions.None);
156 userNameProp = new ConfigurationProperty ("userName", typeof (string), "machine");
157 webGardenProp = new ConfigurationProperty ("webGarden", typeof (bool), false);
158 properties = new ConfigurationPropertyCollection ();
160 properties.Add (autoConfigProp);
161 properties.Add (clientConnectedCheckProp);
162 properties.Add (comAuthenticationLevelProp);
163 properties.Add (comImpersonationLevelProp);
164 properties.Add (cpuMaskProp);
165 properties.Add (enableProp);
166 properties.Add (idleTimeoutProp);
167 properties.Add (logLevelProp);
168 properties.Add (maxAppDomainsProp);
169 properties.Add (maxIoThreadsProp);
170 properties.Add (maxWorkerThreadsProp);
171 properties.Add (memoryLimitProp);
172 properties.Add (minIoThreadsProp);
173 properties.Add (minWorkerThreadsProp);
174 properties.Add (passwordProp);
175 properties.Add (pingFrequencyProp);
176 properties.Add (pingTimeoutProp);
177 properties.Add (requestLimitProp);
178 properties.Add (requestQueueLimitProp);
179 properties.Add (responseDeadlockIntervalProp);
180 properties.Add (responseRestartDeadlockIntervalProp);
181 properties.Add (restartQueueLimitProp);
182 properties.Add (serverErrorMessageFileProp);
183 properties.Add (shutdownTimeoutProp);
184 properties.Add (timeoutProp);
185 properties.Add (userNameProp);
186 properties.Add (webGardenProp);
188 elementProperty = new ConfigurationElementProperty (new CallbackValidator (typeof (ProcessModelSection), ValidateElement));
192 static void ValidateElement (object o)
194 /* XXX do some sort of element validation here? */
197 protected override ConfigurationElementProperty ElementProperty {
198 get { return elementProperty; }
201 [ConfigurationProperty ("autoConfig", DefaultValue = "False")]
202 public bool AutoConfig {
203 get { return (bool) base [autoConfigProp];}
204 set { base[autoConfigProp] = value; }
207 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
208 [ConfigurationProperty ("clientConnectedCheck", DefaultValue = "00:00:05")]
209 public TimeSpan ClientConnectedCheck {
210 get { return (TimeSpan) base [clientConnectedCheckProp];}
211 set { base[clientConnectedCheckProp] = value; }
214 [ConfigurationProperty ("comAuthenticationLevel", DefaultValue = "Connect")]
215 public ProcessModelComAuthenticationLevel ComAuthenticationLevel {
216 get { return (ProcessModelComAuthenticationLevel) base [comAuthenticationLevelProp];}
217 set { base[comAuthenticationLevelProp] = value; }
220 [ConfigurationProperty ("comImpersonationLevel", DefaultValue = "Impersonate")]
221 public ProcessModelComImpersonationLevel ComImpersonationLevel {
222 get { return (ProcessModelComImpersonationLevel) base [comImpersonationLevelProp];}
223 set { base[comImpersonationLevelProp] = value; }
226 [ConfigurationProperty ("cpuMask", DefaultValue = "0xffffffff")]
228 get { return (int) base [cpuMaskProp];}
229 set { base[cpuMaskProp] = value; }
232 [ConfigurationProperty ("enable", DefaultValue = "True")]
234 get { return (bool) base [enableProp];}
235 set { base[enableProp] = value; }
238 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
239 [ConfigurationProperty ("idleTimeout", DefaultValue = "10675199.02:48:05.4775807")]
240 public TimeSpan IdleTimeout {
241 get { return (TimeSpan) base [idleTimeoutProp];}
242 set { base[idleTimeoutProp] = value; }
245 [ConfigurationProperty ("logLevel", DefaultValue = "Errors")]
246 public ProcessModelLogLevel LogLevel {
247 get { return (ProcessModelLogLevel) base [logLevelProp];}
248 set { base[logLevelProp] = value; }
251 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
252 [ConfigurationProperty ("maxAppDomains", DefaultValue = "2000")]
253 public int MaxAppDomains {
254 get { return (int) base [maxAppDomainsProp];}
255 set { base[maxAppDomainsProp] = value; }
258 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
259 [ConfigurationProperty ("maxIoThreads", DefaultValue = "20")]
260 public int MaxIOThreads {
261 get { return (int) base [maxIoThreadsProp];}
262 set { base[maxIoThreadsProp] = value; }
265 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
266 [ConfigurationProperty ("maxWorkerThreads", DefaultValue = "20")]
267 public int MaxWorkerThreads {
268 get { return (int) base [maxWorkerThreadsProp];}
269 set { base[maxWorkerThreadsProp] = value; }
272 [ConfigurationProperty ("memoryLimit", DefaultValue = "60")]
273 public int MemoryLimit {
274 get { return (int) base [memoryLimitProp];}
275 set { base[memoryLimitProp] = value; }
278 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
279 [ConfigurationProperty ("minIoThreads", DefaultValue = "1")]
280 public int MinIOThreads {
281 get { return (int) base [minIoThreadsProp];}
282 set { base[minIoThreadsProp] = value; }
285 [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue- 1)]
286 [ConfigurationProperty ("minWorkerThreads", DefaultValue = "1")]
287 public int MinWorkerThreads {
288 get { return (int) base [minWorkerThreadsProp];}
289 set { base[minWorkerThreadsProp] = value; }
292 [ConfigurationProperty ("password", DefaultValue = "AutoGenerate")]
293 public string Password {
294 get { return (string) base [passwordProp];}
295 set { base[passwordProp] = value; }
298 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
299 [ConfigurationProperty ("pingFrequency", DefaultValue = "10675199.02:48:05.4775807")]
300 public TimeSpan PingFrequency {
301 get { return (TimeSpan) base [pingFrequencyProp];}
302 set { base[pingFrequencyProp] = value; }
305 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
306 [ConfigurationProperty ("pingTimeout", DefaultValue = "10675199.02:48:05.4775807")]
307 public TimeSpan PingTimeout {
308 get { return (TimeSpan) base [pingTimeoutProp];}
309 set { base[pingTimeoutProp] = value; }
312 [TypeConverter (typeof (InfiniteIntConverter))]
313 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
314 [ConfigurationProperty ("requestLimit", DefaultValue = "2147483647")]
315 public int RequestLimit {
316 get { return (int) base [requestLimitProp];}
317 set { base[requestLimitProp] = value; }
320 [TypeConverter (typeof (InfiniteIntConverter))]
321 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
322 [ConfigurationProperty ("requestQueueLimit", DefaultValue = "5000")]
323 public int RequestQueueLimit {
324 get { return (int) base [requestQueueLimitProp];}
325 set { base[requestQueueLimitProp] = value; }
328 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
329 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
330 [ConfigurationProperty ("responseDeadlockInterval", DefaultValue = "00:03:00")]
331 public TimeSpan ResponseDeadlockInterval {
332 get { return (TimeSpan) base [responseDeadlockIntervalProp];}
333 set { base[responseDeadlockIntervalProp] = value; }
336 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
337 [ConfigurationProperty ("responseRestartDeadlockInterval", DefaultValue = "00:03:00")]
338 public TimeSpan ResponseRestartDeadlockInterval {
339 get { return (TimeSpan) base [responseRestartDeadlockIntervalProp];}
340 set { base[responseRestartDeadlockIntervalProp] = value; }
343 [TypeConverter (typeof (InfiniteIntConverter))]
344 [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
345 [ConfigurationProperty ("restartQueueLimit", DefaultValue = "10")]
346 public int RestartQueueLimit {
347 get { return (int) base [restartQueueLimitProp];}
348 set { base[restartQueueLimitProp] = value; }
351 [ConfigurationProperty ("serverErrorMessageFile", DefaultValue = "")]
352 public string ServerErrorMessageFile {
353 get { return (string) base [serverErrorMessageFileProp];}
354 set { base[serverErrorMessageFileProp] = value; }
357 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
358 [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
359 [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:00:05")]
360 public TimeSpan ShutdownTimeout {
361 get { return (TimeSpan) base [shutdownTimeoutProp];}
362 set { base[shutdownTimeoutProp] = value; }
365 [TypeConverter (typeof (InfiniteTimeSpanConverter))]
366 [ConfigurationProperty ("timeout", DefaultValue = "10675199.02:48:05.4775807")]
367 public TimeSpan Timeout {
368 get { return (TimeSpan) base [timeoutProp];}
369 set { base[timeoutProp] = value; }
372 [ConfigurationProperty ("userName", DefaultValue = "machine")]
373 public string UserName {
374 get { return (string) base [userNameProp];}
375 set { base[userNameProp] = value; }
378 [ConfigurationProperty ("webGarden", DefaultValue = "False")]
379 public bool WebGarden {
380 get { return (bool) base [webGardenProp];}
381 set { base[webGardenProp] = value; }
384 protected override ConfigurationPropertyCollection Properties {
385 get { return properties; }