コード例 #1
0
        private static async Task WaitForState(Func <IIS.ObjectState> getState, IIS.ObjectState state)
        {
            TimeSpan totalWait = TimeSpan.Zero;

            IIS.ObjectState?currentState;
            while ((currentState = SafeGetState(getState)) != state)
            {
                totalWait += _waitInterval;
                if (totalWait > _maxWaitInterval)
                {
                    throw new InvalidOperationException(String.Format("State unchanged after {0} seconds. Expected state: '{1}', actual state: '{2}'.",
                                                                      totalWait.TotalSeconds, state, currentState));
                }
                await Task.Delay(_waitInterval);
            }
        }
コード例 #2
0
 public void VerifyAppPoolState(string appPoolName, Microsoft.Web.Administration.ObjectState state)
 {
     try
     {
         using (ServerManager serverManager = GetServerManager())
         {
             ApplicationPoolCollection appPools = serverManager.ApplicationPools;
             if (appPools[appPoolName].State == state)
             {
                 TestUtility.LogInformation(String.Format("Verified state for app pool {0} is {1}.", appPoolName, state.ToString()));
             }
             else
             {
                 TestUtility.LogInformation(String.Format("Unexpected state {0} for app pool  {1}.", state, appPoolName.ToString()));
             }
         }
     }
     catch (Exception ex)
     {
         TestUtility.LogInformation(String.Format("#################### Failed to verify state for app pool {0}. Reason: {1} ####################", appPoolName, ex.Message));
     }
 }
コード例 #3
0
 public static async Task WaitForState(this IIS.ApplicationPool appPool, IIS.ObjectState state)
 {
     await WaitForState(() => appPool.State, state);
 }
コード例 #4
0
 public static async Task WaitForState(this IIS.Site site, IIS.ObjectState state)
 {
     await WaitForState(() => site.State, state);
 }
コード例 #5
0
ファイル: IISExtensions.cs プロジェクト: izevaka/kudu
 public static void WaitForState(this IIS.Site site, IIS.ObjectState state)
 {
     new PollingWait(() => { }, () => site.State == state).Invoke();
 }
コード例 #6
0
ファイル: IISExtensions.cs プロジェクト: izevaka/kudu
 public static void WaitForState(this IIS.ApplicationPool appPool, IIS.ObjectState state)
 {
     new PollingWait(() => { }, () => appPool.State == state).Invoke();
 }