IIS7, web.config to allow only static file handler in directory /uploads of website

前端 未结 1 1198
陌清茗
陌清茗 2020-11-30 01:10

If it\'s possible which I think so, How do I modify my web.config to make a sub directory static -- files inside will only processed as static file, even if its name is \"as

相关标签:
1条回答
  • 2020-11-30 01:28

    Add the following to a web.config file in the folder containing the files you wish to be served only as static content:

    <configuration>
        <system.webServer>
            <handlers>
               <clear />
                <add 
                    name="StaticFile" 
                    path="*" verb="*" 
                    modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" 
                    resourceType="Either" 
                    requireAccess="Read" />
            </handlers>
            <staticContent>
                <mimeMap fileExtension=".*" mimeType="application/octet-stream" />
            </staticContent>
        </system.webServer>
    </configuration>
    
    0 讨论(0)
提交回复
热议问题