microsoft / IIS.ServiceMonitor

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

APPCMD Error 13 when environment variable value contains a single quote #40

Closed rongriffin closed 4 years ago

rongriffin commented 5 years ago

If an environment variable contains a single quote, I get the following error:

Service 'w3svc' has been stopped APPCMD failed with error code 13 Failed to update IIS configuration

Since appcmd.exe is just being used to write environment variables to applicationHost.config, should it XML encode the data?

rongriffin commented 5 years ago

I tried to encode the single quote as ' in the environment variables before I ran ServiceMonitor.exe.

AppCmd.exe must already handle XML encoding, because it landed in applicationHost.config double encoded as '.

So, a single quote breaks AppCmd, but pre-encoding results in double encoding and breaks my application. Any suggestions for a workaround?

jhkimnew commented 4 years ago

This is fixed on https://github.com/microsoft/IIS.ServiceMonitor/releases/tag/v2.0.1.10.