I have SMData
Application in my Default Web Site
. I have added attachments
virtual directory to SMData
application. Now I want set Content-Disposition
header for attachment
virtual directory. I tried this, but no success:
SET XXXsiteNameXXX=Default Web Site
SET XXXappNameXXX=SMData
appcmd set config "%XXXsiteNameXXX%/%XXXappNameXXX%/attachments" -section:system.webServer/httpProtocol /+"customHeaders.[name='Content-Disposition',value='attachment']"
It is trowing error:
Applied configuration changes to section "system.webServer/httpProtocol" for "MA CHINE/WEBROOT/APPHOST/Default Web Site/SMData/attachments" at configuration comm it path "MACHINE/WEBROOT/APPHOST/Default Web Site/SMData/attachments" ERROR ( hresult:80070003, message:Failed to commit configuration changes. The system cannot find the path specified.
I found problem. I was creating virtual directory with this code:
SET XXXtaskDocumentsPathXXX="C:/docs"
%systemroot%/system32/inetsrv/APPCMD add vdir /app.name:"%XXXsiteNameXXX%/%XXXappNameXXX%" /path:"/attachments" /physicalPath:%XXXtaskDocumentsPathXXX%
Problem is in /
in Path. Appcmd doesn't converting it to \
when creating Virtual Directory. And for result Creating web.config
is failing. I changed it to backslash and all started to work.