ProcessModelSection.cs 17 KB

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