microsoft / IIS.ServiceMonitor

An entrypoint process for running IIS in Windows containers
MIT License
126 stars 42 forks source link

Errors while starting ServiceMonitor manually #16

Closed shirhatti closed 6 years ago

shirhatti commented 6 years ago

From @vladimir-kazakov on August 30, 2017 6:51

When I start ServiceMonitor inside a container for the first time, I see the following output:

PS C:> .\ServiceMonitor.exe w3svc

Service 'w3svc' has been stopped ERROR ( message:Cannot find requested collection element. )

APPCMD failed with error code 4312 Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST" ERROR ( message:Cannot find requested collection element. )

APPCMD failed with error code 4312 Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

Service 'w3svc' started

Terminating it and starting ServiceMonitor again results in the following output:

PS C:> .\ServiceMonitor.exe w3svc

Service 'w3svc' has been stopped Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST" Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST" Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST" Applied configuration changes to section "system.applicationHost/applicationPools" for "MACHINE/WEBROOT/APPHOST" at configuration commit path "MACHINE/WEBROOT/APPHOST"

Service 'w3svc' started

These errors (in the first quote) happen only if starting ServiceMonitor manually. Without overriding the entry point, everything works as expected and the output looks like:

Service 'w3svc' has been stopped

Service 'w3svc' started

Since the default entry point and manually starting ServiceMonitor is the same command in this case, I'd expect the output to be the same - without any errors.

In order to reproduce these errors:

  1. Pull the latest image: docker pull microsoft/aspnet (I tried 4.6.2 and 4.7 - the result is the same).
  2. Enter the container by overriding the default entry point: docker run -it --rm --entrypoint powershell microsoft/aspnet.
  3. Inside the container, start ServiceMonitor: .\ServiceMonitor.exe w3svc.

The container host is Windows Server 2016 Standard (Version 1607, Build 14393.1593) and the Docker version is 17.03.2-ee-5, build fa09039.

It would be also interesting to know whether these errors can be safely ignored (until they're being fixed). It seems that everything else works as expected, but maybe I don't notice something.

Copied from original issue: Microsoft/aspnet-docker#47

shirhatti commented 6 years ago

From @kvonbredow on October 19, 2017 14:19

I am experiencing similar issues, though for me these errors happen when I both start the ServiceMonitor manually and when using it as my entrypoint for docker run .

For me, the container host is running Windows Server Build 14393.1770 and while I see these errors in containers based on the windows server core images tagged '10.0.14393.1770' and '10.0.14393.1715', it seems to work just fine using 'microsoft/windowsservercore:10.0.14393.1593'

shirhatti commented 6 years ago

From @shrishrirang on November 30, 2017 21:17

Seeing the same issue with microsoft/aspnet:4.7.1 and when using docker run. The site works fine though. Can you share some info on this and if it is safe to ignore these errors (given that the site is working fine)?

shirhatti commented 6 years ago

From @caokennedy on January 4, 2018 15:7

Having the same issue with docker run microsoft/aspnet. Has anyone with this issued resolved it?

shirhatti commented 6 years ago

From @HongGit on January 4, 2018 18:49

@mcy94w and @shirhatti can you please take a look?

mcy94w commented 6 years ago

This is the expected behavior. ServiceMonitor.exe will do the following things when it start.

  1. Stop w3svc
  2. Remove all the Env Var from AppHost.config using appcmd.
  3. Add Env Var to Apphost.config using appcmd.
  4. Start w3svc.

The error message you see are from step 2. When you first start ServiceMonitor.exe. Those Env Var does not exist. So appcmd will output error message. We have made the fix to mute the appcmd output for the next ServiceMonitor.exe release. https://github.com/Microsoft/IIS.ServiceMonitor/pull/12