我正在尝试安装letsencrypt证书 Certify ,但我收到错误,(我认为)这与 Certify 无关。问题是如何配置我的 web.config 来处理我的 Asp.Net Core - Angular2 应用程序。
我没有配置web.config,Javascript services做过。在 Certify 网页上,在页面底部写下了我的问题:
I get the error "Automated checks for extensionless content failed.." This means your web server configuration is not allowing files with no extension to be served to site visitors. Unfortunately this is a requirement of the Lets Encrypt service in order for it to fetch the verification file which is automatically created within your site when you request a certificate (more info).
To help with this requirement we try to automatically configure this for you. If you look in {your site}.well-known\acme-challenge you will see we have created a web.config and a file called configcheck. If you can't browse to this configcheck file in your web browser (http://{your site}/.well-known/acme-challenge/configcheck then the Lets Encrypt service can't access the files it needs either. You can edit the web.config file in this folder to get extensionless files working, then you can re-request your certificate. A mimeMap entry for either "." or ".*" usually works depending on your operating system version.
请专家帮我改正我的 web.config 文件,以支持 letencrypt 的任何需求。目前 .well-known/acme-challenge 中的任何内容都无法通过 WebBrowser 访问。
我的 web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
<rewrite>
<rules>
<rule name="redirect" stopProcessing="true">
<match url="^$" />
<action type="Rewrite" url="/index.html" />
</rule>
<rule name="Angular 2 pushState routing" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" pattern=".*\.[\d\w]+$" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
<add input="{REQUEST_URI}" pattern="^/(.well-known)" negate="true"/>
<add input="{REQUEST_URI}" pattern="^/(signin)" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
最佳答案
将其放入 Lets Encrypt DNS 验证文件旁边的 .\.well-known\acme-challenge\Web.Config
文件中。无需更改您已有的Web.Config
。它所做的一切都是告诉 IIS 在 Web.Config
所在的目录中以 mime 类型 text/plain
的方式清除不带扩展名的文件,正如 Lets Encrypt 所期望的那样。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="." mimeType="text/plain" />
</staticContent>
<handlers>
<clear />
<add name="StaticFile" path="*" verb="GET" modules="StaticFileModule" resourceType="Either" />
</handlers>
</system.webServer>
</configuration>
关于asp.net-core - 为 LetsEncrypt 设置 web.config - 使用 Asp.NET Core 和 Angular 2 进行认证(Javascript 服务),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43409878/