C# 以编程方式添加多个Recycling.LogEventOnRecycle事件
我有: 我遇到的问题是,我不知道如何为LogEventOnRecycle事件分配多个属性。任何帮助都将不胜感激。。。。使用+=instat of=已经有很多年了,因为它会添加而不会覆盖某些内容。根据MSDN,是一种类型,它是一个枚举,具有一个FlagsAttribute属性,允许其成员值按位组合 因此,以下几点应该适合您:C# 以编程方式添加多个Recycling.LogEventOnRecycle事件,c#,.net,C#,.net,我有: 我遇到的问题是,我不知道如何为LogEventOnRecycle事件分配多个属性。任何帮助都将不胜感激。。。。使用+=instat of=已经有很多年了,因为它会添加而不会覆盖某些内容。根据MSDN,是一种类型,它是一个枚举,具有一个FlagsAttribute属性,允许其成员值按位组合 因此,以下几点应该适合您: ApplicationPool BOB = iisManager.ApplicationPools.Add("BOB"); BOB.Recycling.Log
ApplicationPool BOB = iisManager.ApplicationPools.Add("BOB");
BOB.Recycling.LogEventOnRecycle = RecyclingLogEventOnRecycle.OnDemand;
BOB.Recycling.LogEventOnRecycle = RecyclingLogEventOnRecycle.IsapiUnhealthy;
请注意,您需要使用逻辑位或运算符|,而不是加法运算符+ @Stelly你能把LogEventOnRecycle的声明贴出来吗?谢谢S先生。非常感谢:D
RecyclingLogEventOnRecycle myRecycleEvents =
RecyclingLogEventOnRecycle.OnDemand | RecyclingLogEventOnRecycle.IsapiUnhealthy;
ApplicationPool BOB = iisManager.ApplicationPools.Add("BOB");
BOB.Recycling.LogEventOnRecycle = myRecycleEvents;