iis – appcmd set config appSettings – 带加号()的值正在转换为空格

我正在尝试使用appcmd在web.config中设置appSetting,appSetting的值包含一个符号.当我运行appcmd时,会创建appSetting,但会将其转换为空格.

appcmd我正在运行:

"C:\system32\inetsrv\appcmd.exe" set config "Default Web Site" /section:appSettings /+"[key='Test',value='++ ++']"

创建的appSetting:

<add key="Test" value="     " />

我尝试使用+而不是在appcmd中,这不起作用(它在appSetting中被转换为’b’.

有没有人知道如何在使用appcmd时获得appSetting中包含的符号?

最佳答案 您是否尝试过使用unicode值为%u002b?

"C:\system32\inetsrv\appcmd.exe" set config "Default Web Site" /section:appSettings 
/+"[key='Test',value='%%u002b']"

您需要添加额外的%符号才能转义unicode值中的%.

这应该导致Test键的值为.

看到:

> Appcmd error setting MimeType + missing
> Unicode Plus sign

点赞