Quantcast
Channel: MSBuild Extension Pack
Viewing all articles
Browse latest Browse all 1211

Commented Issue: Iis7AppPool Start throws COMException [11577]

$
0
0
I was getting a COMException: _The object identifier does not represent a valid object_ from the Start action of the Iis7AppPool task. Google suggests this might be to do with the Windows Process Activation Service not being ready. I've forked the source and added the following method to catch the exception, wait 100ms and retry up to 3 times:

private void StartAppPoolWithRetry(int retryCount)
{
try
{
this.pool.Start();
}
catch (COMException e)
{
if (e.Message.Contains("The object identifier does not represent a valid object")
&& retryCount < 3)
{
retryCount++;
LogTaskMessage(string.Format(CultureInfo.InvariantCulture, "..Sleeping and retrying {0}", retryCount));
Thread.Sleep(100);
StartAppPoolWithRetry(retryCount);
}
else
throw;
}
}

Then I'm calling StartAppPoolWithRetry(0) instead of this.pool.Start().
Comments: Associated with changeset 82661: IIS7\IIS7AppPool.cs: Implement StartAppPoolWithRetry logic

Viewing all articles
Browse latest Browse all 1211

Trending Articles