How to fix 404 when requesting ACME Challenge file in .well-known?

Programming, error messages and sample code > sample code
 

Symptoms

You might get 404 error when you try to complete Lets Encryption Domain Verification on link like
 
http://yourdomain.com/.well-known/acme-challenge/n8bL7-FyHIgCXEccY5q81Y-E0gFhMp1ymFq2SpMjIvQ
 

Resolution

To fix it, save below code to web.config and put it to the folder "acme-challenge".
<?xml version = "1.0" encoding="UTF-8"?>
 <configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension="." mimeType="text/plain" />
        </staticContent>
        <handlers>
            <clear />
            <add name="StaticFile" path="*" verb="*" type="" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
        </handlers>
     </system.webServer>
 </configuration>