Reputation: 85
We have azure hosted service, and now i need to setup the ARR (application request routing) on it. I followed the blog http://robindotnet.wordpress.com/2011/07/ and ARR is working fine. Now I need to enable the diskCaching for this and 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' with unique key attribute 'path' set to 'c:\cache'. )
and there no content getting cached in this folder. Any direction or help is appreciated.
Below is complete cmd file for 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 the same thing here for IIS [http://www.iis.net/learn/extensions/configuring-application-request-routing-(arr)/configure-and-enable-disk-cache-in-application-request-routing], that can be enabled manually. But we need to enable this programmatically.
Upvotes: 1
Views: 714
Reputation: 1673
As is often the case, the error message holds a hint as to the cause. The problem is you can have only one entry per drive location value. Which means that script runs fine the first time, but the second time it will throw because the value has already been applied.
You cannot remove the node using appcmd (it doesn't support clearing a collection), but you can using a text editor (this file: %windir%\System32\inetsrv\config\applicationHost.config). Or you can run a powershell script:
Import-Module WebAdministration
Remove-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/diskCache" -name "."
In either case, this is the node that will be manipulated:
<driveLocation path="c:\cache" maxUsage="0" />
After that you'll be able to re-run your code.
Upvotes: 1