Verify the application exist inside the windows container, connect to the cmd of the "frontendapiwin" container using the docker exec command
1. C:\> docker exec -it 64a61d823b28 cmd
- "64a61d823b28 " - docker container id
- It should take us inside the container.
Run the powershell inside the "frontendapiwin" the container
1.1 C:\inetpub\wwwroot> powershell
Using Powershell to manage application web configuration
1.1.1 PS C:\inetpub\wwwroot> gc .\web.config or gc web.config
- Gets the content (gc) of the item at the specified location (C:\inetpub\wwwroot\web.config)
> [xml]$web = gc .\web.config
- The [xml] casts the variable as an XML object.
- <?xml>
<configuration>
<appsettings>
<add key="DBCon" value="db value."/>
...
</appsettings>
...
</configuration>
> $web.configuration.appSettings.SelectNodes("add[@key='DBCon']")
- display DBCon key value
- key value
----- -------
DBCon db value.
> $key=$web.configuration.appSettings.SelectNodes("add[@key='DBCon']")
- assign to key
> $key
- another way display DBCon key value
> $key.SetAttribute("value","db value changed.")
- change DBCon value
> $web.save(".\web.config")
- save file
> exit => exit from powershell
> exit = exit from container
1. C:\> docker exec -it 64a61d823b28 cmd
- "64a61d823b28 " - docker container id
- It should take us inside the container.
Run the powershell inside the "frontendapiwin" the container
1.1 C:\inetpub\wwwroot> powershell
Using Powershell to manage application web configuration
1.1.1 PS C:\inetpub\wwwroot> gc .\web.config or gc web.config
- Gets the content (gc) of the item at the specified location (C:\inetpub\wwwroot\web.config)
> [xml]$web = gc .\web.config
- The [xml] casts the variable as an XML object.
- <?xml>
<configuration>
<appsettings>
<add key="DBCon" value="db value."/>
...
</appsettings>
...
</configuration>
> $web.configuration.appSettings.SelectNodes("add[@key='DBCon']")
- display DBCon key value
- key value
----- -------
DBCon db value.
> $key=$web.configuration.appSettings.SelectNodes("add[@key='DBCon']")
- assign to key
> $key
- another way display DBCon key value
> $key.SetAttribute("value","db value changed.")
- change DBCon value
> $web.save(".\web.config")
- save file
> exit => exit from powershell
> exit = exit from container