iis 7.5 - Azure ARR error while enabling disk cache -
we have azure hosted service, , need setup arr (application request routing) on it. followed blog http://robindotnet.wordpress.com/2011/07/ , arr working fine. need enable diskcaching , i'm trying below command:
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webserver/diskcache /+"[path='c:\cache',maxusage='0']" /commit:apphost >> c:\setdiskcache.txt
but getting below error: error ( message:new drivelocation object missing required attributes. cannot add duplicate collection entry of type 'drivelocation' unique key attribute 'path' set 'c:\cache'. )
and there no content getting cached in folder. direction or appreciated.
below complete cmd file reference:
cd /d "%~dp0" start /wait msiexec.exe /i webfarm_amd64_en-us.msi /qn /log c:\installwebfarmlog.txt start /wait msiexec.exe /i requestrouter_amd64_en-us.msi /qn /log c:\installarrlog.txt %windir%\system32\inetsrv\appcmd.exe set config -section:system.webserver/proxy /enabled:"true" /reverserewritehostinresponseheaders:"false" /preservehostheader:"true" /commit:apphost >> c:\setproxylog.txt %windir%\system32\inetsrv\appcmd.exe set config -section:applicationpools -applicationpooldefaults.processmodel.idletimeout:00:00:00 >> c:\setapppool.txt %windir%\system32\inetsrv\appcmd.exe set config -section:system.webserver/diskcache /+"[path='c:\cache',maxusage='0']" /commit:apphost >> c:\setdiskcache.txt exit /b 0
i can find same thing here iis [http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/configure-and-enable-disk-cache-in-application-request-routing], can enabled manually. need enable programmatically.
as case, error message holds hint cause. problem can have 1 entry per drive location value. means script runs fine first time, second time throw because value has been applied.
you cannot remove node using appcmd (it doesn't support clearing collection), can using text editor (this file: %windir%\system32\inetsrv\config\applicationhost.config). or can run powershell script:
import-module webadministration remove-webconfigurationproperty -pspath 'machine/webroot/apphost' -filter "system.webserver/diskcache" -name "."
in either case, node manipulated:
<drivelocation path="c:\cache" maxusage="0" />
after you'll able re-run code.