Error 0x80070020 when you try to run Setup Lync Server Components

Recently I had an error during the setup of Lync Server Components regarding Enabling of the  web site “Lync Server Internal Web Site”. A fast google search indicated it was something about IIS not being able to start the default website because of port 80 or 443 was being used by another program. To find out what software was using the ports I did the following, solution found in this KB article:

Run the following command from a command prompt to find the PID of the process which is using TCP port 80 and/or 443. 
               netstat -aon | find “:80” 
               netstat -aon | find “:443”
You will see an output similar to the following. Remember the actual PID will vary from case to case. 
               TCP                 LISTENING       3604 
               TCP               LISTENING       3320
Now using Task Manager you can easily find out to which process the above PID belongs and take appropriate action.

In my case I was using TeamViewer to remote in to the server during installation. Closing TeamViewer and getting the customer to run the installation solved the problem.

Here is the exact error message I got in the logs

 Error: The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)
▼ Details
└ Type: FileLoadException
└ ▼ Stack Trace
    └   at Microsoft.Web.Administration.Interop.IAppHostMethodInstance.Execute()
at Microsoft.Web.Administration.ConfigurationElement.ExecuteMethod(String methodName)
at Microsoft.Web.Administration.Site.Start()
at Microsoft.Rtc.Management.Deployment.Roles.WebServices.LocalActivate(IService service, Computer computer)
at Microsoft.Rtc.Management.Deployment.Core.Service.LocalActivate(Computer computer)
at Microsoft.Rtc.Management.Internal.Utilities.LogWriter.InvokeAndLog[T](Action`1 action, T arg) 
 └    Error: An error occurred: “System.IO.FileLoadException” “The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)”

Error message when you try to install a certificate by using IIS 7.0 Manager

When you try to install a certificate from a PKCS#7 file by using Internet Information Services (IIS) 7.0 Manager, you may receive one of the following error messages:    

Error message 1
Cannot find the certificate request associated with this certificate file. A certificate request must be completed on the computer where it was created.

Error message 2
There was an error while performing this operation
Details: CertEnroll::CX509Enrollment::p_InstallResponse: ASN1 bad tag value met. 0x8009310b (ASN:276)
This issue occurs because IIS Manager performs a lookup operation to look for a friendly name of the certificate during the installation. However, the code that performs this lookup operation misses this specific case, and it does not know how to retrieve the friendly name of a certificate in a PKCS#7 file. Therefore, the lookup operation fails, and you receive the error message. This issue is scheduled to be resolved in the next Windows Server 2008 service pack.
Note:  The certificate is installed correctly despite the error message
Thanks to Karsten Palmvig who pointed me in the right direction in this post: