ProcessModelSection.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  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. comAuthenticationLevelProp = new ConfigurationProperty ("comAuthenticationLevel", typeof (ProcessModelComAuthenticationLevel), ProcessModelComAuthenticationLevel.Connect);
  69. comImpersonationLevelProp = new ConfigurationProperty ("comImpersonationLevel", typeof (ProcessModelComImpersonationLevel), ProcessModelComImpersonationLevel.Impersonate);
  70. cpuMaskProp = new ConfigurationProperty ("cpuMask", typeof (int), 0xffffffff);
  71. enableProp = new ConfigurationProperty ("enable", typeof (bool), true);
  72. idleTimeoutProp = new ConfigurationProperty ("idleTimeout", typeof (TimeSpan), TimeSpan.MaxValue);
  73. logLevelProp = new ConfigurationProperty ("logLevel", typeof (ProcessModelLogLevel), ProcessModelLogLevel.Errors);
  74. maxAppDomainsProp = new ConfigurationProperty ("maxAppDomains", typeof (int), 2000);
  75. maxIoThreadsProp = new ConfigurationProperty ("maxIoThreads", typeof (int), 20);
  76. maxWorkerThreadsProp = new ConfigurationProperty ("maxWorkerThreads", typeof (int), 20);
  77. memoryLimitProp = new ConfigurationProperty ("memoryLimit", typeof (int), 60);
  78. minIoThreadsProp = new ConfigurationProperty ("minIoThreads", typeof (int), 1);
  79. minWorkerThreadsProp = new ConfigurationProperty ("minWorkerThreads", typeof (int), 1);
  80. passwordProp = new ConfigurationProperty ("password", typeof (string), "AutoGenerate");
  81. pingFrequencyProp = new ConfigurationProperty ("pingFrequency", typeof (TimeSpan), TimeSpan.MaxValue);
  82. pingTimeoutProp = new ConfigurationProperty ("pingTimeout", typeof (TimeSpan), TimeSpan.MaxValue);
  83. requestLimitProp = new ConfigurationProperty ("requestLimit", typeof (int), Int32.MaxValue);
  84. requestQueueLimitProp = new ConfigurationProperty ("requestQueueLimit", typeof (int), 5000);
  85. responseDeadlockIntervalProp = new ConfigurationProperty ("responseDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3));
  86. responseRestartDeadlockIntervalProp = new ConfigurationProperty ("responseRestartDeadlockInterval", typeof (TimeSpan), TimeSpan.FromMinutes (3));
  87. restartQueueLimitProp = new ConfigurationProperty ("restartQueueLimit", typeof (int), 10);
  88. serverErrorMessageFileProp = new ConfigurationProperty ("serverErrorMessageFile", typeof (string), "");
  89. shutdownTimeoutProp = new ConfigurationProperty ("shutdownTimeout", typeof (TimeSpan), TimeSpan.FromSeconds (5));
  90. timeoutProp = new ConfigurationProperty ("timeout", typeof (TimeSpan), TimeSpan.MaxValue);
  91. userNameProp = new ConfigurationProperty ("userName", typeof (string), "machine");
  92. webGardenProp = new ConfigurationProperty ("webGarden", typeof (bool), false);
  93. properties = new ConfigurationPropertyCollection ();
  94. properties.Add (autoConfigProp);
  95. properties.Add (clientConnectedCheckProp);
  96. properties.Add (comAuthenticationLevelProp);
  97. properties.Add (comImpersonationLevelProp);
  98. properties.Add (cpuMaskProp);
  99. properties.Add (enableProp);
  100. properties.Add (idleTimeoutProp);
  101. properties.Add (logLevelProp);
  102. properties.Add (maxAppDomainsProp);
  103. properties.Add (maxIoThreadsProp);
  104. properties.Add (maxWorkerThreadsProp);
  105. properties.Add (memoryLimitProp);
  106. properties.Add (minIoThreadsProp);
  107. properties.Add (minWorkerThreadsProp);
  108. properties.Add (passwordProp);
  109. properties.Add (pingFrequencyProp);
  110. properties.Add (pingTimeoutProp);
  111. properties.Add (requestLimitProp);
  112. properties.Add (requestQueueLimitProp);
  113. properties.Add (responseDeadlockIntervalProp);
  114. properties.Add (responseRestartDeadlockIntervalProp);
  115. properties.Add (restartQueueLimitProp);
  116. properties.Add (serverErrorMessageFileProp);
  117. properties.Add (shutdownTimeoutProp);
  118. properties.Add (timeoutProp);
  119. properties.Add (userNameProp);
  120. properties.Add (webGardenProp);
  121. }
  122. [ConfigurationProperty ("autoConfig", DefaultValue = "False")]
  123. public bool AutoConfig {
  124. get { return (bool) base [autoConfigProp];}
  125. set { base[autoConfigProp] = value; }
  126. }
  127. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  128. [ConfigurationProperty ("clientConnectedCheck", DefaultValue = "00:00:05")]
  129. public TimeSpan ClientConnectedCheck {
  130. get { return (TimeSpan) base [clientConnectedCheckProp];}
  131. set { base[clientConnectedCheckProp] = value; }
  132. }
  133. [ConfigurationProperty ("comAuthenticationLevel", DefaultValue = "Connect")]
  134. public ProcessModelComAuthenticationLevel ComAuthenticationLevel {
  135. get { return (ProcessModelComAuthenticationLevel) base [comAuthenticationLevelProp];}
  136. set { base[comAuthenticationLevelProp] = value; }
  137. }
  138. [ConfigurationProperty ("comImpersonationLevel", DefaultValue = "Impersonate")]
  139. public ProcessModelComImpersonationLevel ComImpersonationLevel {
  140. get { return (ProcessModelComImpersonationLevel) base [comImpersonationLevelProp];}
  141. set { base[comImpersonationLevelProp] = value; }
  142. }
  143. [ConfigurationProperty ("cpuMask", DefaultValue = "0xffffffff")]
  144. public int CpuMask {
  145. get { return (int) base [cpuMaskProp];}
  146. set { base[cpuMaskProp] = value; }
  147. }
  148. [ConfigurationProperty ("enable", DefaultValue = "True")]
  149. public bool Enable {
  150. get { return (bool) base [enableProp];}
  151. set { base[enableProp] = value; }
  152. }
  153. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  154. [ConfigurationProperty ("idleTimeout", DefaultValue = "10675199.02:48:05.4775807")]
  155. public TimeSpan IdleTimeout {
  156. get { return (TimeSpan) base [idleTimeoutProp];}
  157. set { base[idleTimeoutProp] = value; }
  158. }
  159. [ConfigurationProperty ("logLevel", DefaultValue = "Errors")]
  160. public ProcessModelLogLevel LogLevel {
  161. get { return (ProcessModelLogLevel) base [logLevelProp];}
  162. set { base[logLevelProp] = value; }
  163. }
  164. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
  165. [ConfigurationProperty ("maxAppDomains", DefaultValue = "2000")]
  166. public int MaxAppDomains {
  167. get { return (int) base [maxAppDomainsProp];}
  168. set { base[maxAppDomainsProp] = value; }
  169. }
  170. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
  171. [ConfigurationProperty ("maxIoThreads", DefaultValue = "20")]
  172. public int MaxIOThreads {
  173. get { return (int) base [maxIoThreadsProp];}
  174. set { base[maxIoThreadsProp] = value; }
  175. }
  176. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
  177. [ConfigurationProperty ("maxWorkerThreads", DefaultValue = "20")]
  178. public int MaxWorkerThreads {
  179. get { return (int) base [maxWorkerThreadsProp];}
  180. set { base[maxWorkerThreadsProp] = value; }
  181. }
  182. [ConfigurationProperty ("memoryLimit", DefaultValue = "60")]
  183. public int MemoryLimit {
  184. get { return (int) base [memoryLimitProp];}
  185. set { base[memoryLimitProp] = value; }
  186. }
  187. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue - 1)]
  188. [ConfigurationProperty ("minIoThreads", DefaultValue = "1")]
  189. public int MinIOThreads {
  190. get { return (int) base [minIoThreadsProp];}
  191. set { base[minIoThreadsProp] = value; }
  192. }
  193. [IntegerValidator (MinValue = 1, MaxValue = Int32.MaxValue- 1)]
  194. [ConfigurationProperty ("minWorkerThreads", DefaultValue = "1")]
  195. public int MinWorkerThreads {
  196. get { return (int) base [minWorkerThreadsProp];}
  197. set { base[minWorkerThreadsProp] = value; }
  198. }
  199. [ConfigurationProperty ("password", DefaultValue = "AutoGenerate")]
  200. public string Password {
  201. get { return (string) base [passwordProp];}
  202. set { base[passwordProp] = value; }
  203. }
  204. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  205. [ConfigurationProperty ("pingFrequency", DefaultValue = "10675199.02:48:05.4775807")]
  206. public TimeSpan PingFrequency {
  207. get { return (TimeSpan) base [pingFrequencyProp];}
  208. set { base[pingFrequencyProp] = value; }
  209. }
  210. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  211. [ConfigurationProperty ("pingTimeout", DefaultValue = "10675199.02:48:05.4775807")]
  212. public TimeSpan PingTimeout {
  213. get { return (TimeSpan) base [pingTimeoutProp];}
  214. set { base[pingTimeoutProp] = value; }
  215. }
  216. [TypeConverter (typeof (InfiniteIntConverter))]
  217. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  218. [ConfigurationProperty ("requestLimit", DefaultValue = "2147483647")]
  219. public int RequestLimit {
  220. get { return (int) base [requestLimitProp];}
  221. set { base[requestLimitProp] = value; }
  222. }
  223. [TypeConverter (typeof (InfiniteIntConverter))]
  224. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  225. [ConfigurationProperty ("requestQueueLimit", DefaultValue = "5000")]
  226. public int RequestQueueLimit {
  227. get { return (int) base [requestQueueLimitProp];}
  228. set { base[requestQueueLimitProp] = value; }
  229. }
  230. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  231. [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
  232. [ConfigurationProperty ("responseDeadlockInterval", DefaultValue = "00:03:00")]
  233. public TimeSpan ResponseDeadlockInterval {
  234. get { return (TimeSpan) base [responseDeadlockIntervalProp];}
  235. set { base[responseDeadlockIntervalProp] = value; }
  236. }
  237. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  238. [ConfigurationProperty ("responseRestartDeadlockInterval", DefaultValue = "00:03:00")]
  239. public TimeSpan ResponseRestartDeadlockInterval {
  240. get { return (TimeSpan) base [responseRestartDeadlockIntervalProp];}
  241. set { base[responseRestartDeadlockIntervalProp] = value; }
  242. }
  243. [TypeConverter (typeof (InfiniteIntConverter))]
  244. [IntegerValidator (MinValue = 0, MaxValue = Int32.MaxValue)]
  245. [ConfigurationProperty ("restartQueueLimit", DefaultValue = "10")]
  246. public int RestartQueueLimit {
  247. get { return (int) base [restartQueueLimitProp];}
  248. set { base[restartQueueLimitProp] = value; }
  249. }
  250. [ConfigurationProperty ("serverErrorMessageFile", DefaultValue = "")]
  251. public string ServerErrorMessageFile {
  252. get { return (string) base [serverErrorMessageFileProp];}
  253. set { base[serverErrorMessageFileProp] = value; }
  254. }
  255. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  256. [TimeSpanValidator (MinValueString = "00:00:00", MaxValueString = "10675199.02:48:05.4775807")]
  257. [ConfigurationProperty ("shutdownTimeout", DefaultValue = "00:00:05")]
  258. public TimeSpan ShutdownTimeout {
  259. get { return (TimeSpan) base [shutdownTimeoutProp];}
  260. set { base[shutdownTimeoutProp] = value; }
  261. }
  262. [TypeConverter (typeof (InfiniteTimeSpanConverter))]
  263. [ConfigurationProperty ("timeout", DefaultValue = "10675199.02:48:05.4775807")]
  264. public TimeSpan Timeout {
  265. get { return (TimeSpan) base [timeoutProp];}
  266. set { base[timeoutProp] = value; }
  267. }
  268. [ConfigurationProperty ("userName", DefaultValue = "machine")]
  269. public string UserName {
  270. get { return (string) base [userNameProp];}
  271. set { base[userNameProp] = value; }
  272. }
  273. [ConfigurationProperty ("webGarden", DefaultValue = "False")]
  274. public bool WebGarden {
  275. get { return (bool) base [webGardenProp];}
  276. set { base[webGardenProp] = value; }
  277. }
  278. #if notyet
  279. [MonoTODO]
  280. public ConfigurationElementProperty ElementProperty {
  281. get { throw new NotImplementedException (); }
  282. }
  283. #endif
  284. protected override ConfigurationPropertyCollection Properties {
  285. get { return properties; }
  286. }
  287. }
  288. }
  289. #endif