Falha na atualização do Latromi Web em servidor com múltiplas instâncias

Problema

Em um servidor onde existem várias instâncias do Latromi Web instaladas, a atualização do sistema não acontece.

A pasta com a nova versão até chega a ser criada fisicamente, mas o processo é interrompido antes de ajustar o apontamento da aplicação web para a nova pasta.

Causa

No arquivo de Log do Latromi Installation Service (LatromiInstSvc), as seguintes informações são registradas:

    System.IO.FileLoadException: Filename: \\?\C:\windows\system32\inetsrv\config\applicationHost.config
    Error: Cannot commit configuration changes because the file has changed on disk
    
    
       at Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager.CommitChanges()
       at Microsoft.Web.Administration.ConfigurationManager.CommitChanges()
       at Microsoft.Web.Administration.ServerManager.CommitChanges()
       at LATROMI.Install.SiteHosting.Host.IISHost.CommitChanges()
       at LATROMI.Installer.WebServerManager.CreateWebSite(String webSiteName, Int32 port, String physicalPath, String hostType)

    at LATROMI.Installer.WebServerManager.CreateWebSite(String webSiteName, Int32 port, String physicalPath, String hostType)
       at SyncInvokeCreateWebSite(Object , Object[] , Object[] )
       at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
       at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc)
       at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
       at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
       at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
       at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
       at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)
       at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
       at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
       at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)
       at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
       at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
       at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)
       at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
       at System.ServiceModel.Channels.StreamConnection.OnRead(IAsyncResult result)
       at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
       at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
       at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
       at System.Net.Security.NegotiateStream.ProcessFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.NegotiateStream.ReadCallback(AsyncProtocolRequest asyncRequest)
       at System.Net.AsyncProtocolRequest.CompleteRequest(Int32 result)
       at System.Net.FixedSizeReader.CheckCompletionBeforeNextRead(Int32 bytes)
       at System.Net.FixedSizeReader.ReadCallback(IAsyncResult transportResult)
       at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
       at System.ServiceModel.Channels.ConnectionStream.IOAsyncResult.OnAsyncIOComplete(Object state)
       at System.ServiceModel.Channels.SocketConnection.FinishRead()
       at System.ServiceModel.Channels.SocketConnection.OnReceiveAsync(Object sender, SocketAsyncEventArgs eventArgs)
       at System.ServiceModel.Channels.SocketConnection.OnReceiveAsyncCompleted(Object sender, SocketAsyncEventArgs e)
       at System.Net.Sockets.SocketAsyncEventArgs.OnCompleted(SocketAsyncEventArgs e)
       at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
       at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

Ao que tudo indica, o erro ocorre porque o arquivo de configuração do IIS (applicationHost.config) sofreu alguma alteração entre o momento em que o atualizador iniciou uma modificação gerenciada e o momento em que tentou confirmar essas modificações.

Sendo assim, o motivo do erro pode estar associado à concorrência ao arquivo, onde múltiplas atualizações podem estar ocorrendo ao mesmo tempo.

Ou então, o arquivo pode não ter sido liberado adequadamente após uma modificação concluída

Solução

Investigar o serviço de atualização para corrigir o problema.