How to use APPCMD change configurations for site which name contains blank

2021/01/19 IIS

When we want to change configurations for site, we usualy use appcmd.exe to handle it. However when website name contains blank, it will throw an error like below.

C:\>%windir%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /[name='Default Web Site'].logFile.logExtFileFlags:Date,Time,ClientIP,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,ServerPort,UserAgent,HttpSubStatus,Referer,BytesRecv,BytesSent

Failed to process input: The parameter 'Site'].logFile.logExtFileFlags:Date,Time,ClientIP,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,ServerPort,UserAgent,HttpSubStatus,Referer,BytesRecv,BytesSent' must begin with a / or - (HRESULT=80070057).

So how to handle it?

We should use ‘%20’ replace blank in name. For example, use ‘Exchange%20Back%20End’ instead of ‘Exchange Back End’.

%windir%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /[name='Exchange%20Back%20End'].logFile.logExtFileFlags:Date,Time,ClientIP,UserName,ServerIP,Method,UriStem,UriQuery,TimeTaken,HttpStatus,Win32Status,ServerPort,UserAgent,HttpSubStatus,Referer,BytesRecv,BytesSent

文档信息

Document Information

Search

    LuyaoWechat

    路遥之家

    Table of Contents