为letsencrypt设置web.config - 使用Asp.NET Core和Angular 2进行Certify(Javascript-services)

Mak*_*kla 6 web-config certify lets-encrypt asp.net-core

我正在尝试使用Certify安装letsencrypt证书,但是我收到错误,我认为这与Certify无关.问题是如何配置我的web.config来处理我的Asp.Net Core - Angular2应用程序.

我没有配置web.config,Javascript服务呢.在Certify网页上,在页面底部写下我的问题:

我收到错误"无扩展内容的自动检查失败.."这意味着您的Web服务器配置不允许将没有扩展名的文件提供给网站访问者.不幸的是,这是Lets Encrypt服务的要求,以便它在您请求证书时获取在您的站点中自动创建的验证文件(更多信息).

为了满足此要求,我们尝试自动为您配置.如果您查看{your site} .well-known\acme-challenge,您将看到我们创建了一个web.config和一个名为configcheck的文件.如果您无法在Web浏览器中浏览此configcheck文件(http:// {您的站点} /.熟知/ acme-challenge/configcheck),则Lets Encrypt服务无法访问所需的文件.可以编辑此文件夹中的web.config文件以使无扩展文件正常工作,然后您可以重新请求您的证书."."或".*"的mimeMap条目通常可以根据您的操作系统版本而有效.

有些专家可以帮我纠正我的web.config文件,该文件将支持letsencrypt需要的任何内容.目前,通过WebBrowser无法访问.well-known/acme-challenge内的任何内容.

我的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>
Run Code Online (Sandbox Code Playgroud)

谢谢.
错误的屏幕截图

Eri*_*ric 6

将其放在.\.well-known\acme-challenge\Web.ConfigLets Encrypt DNS验证文件旁边的文件中.无需改变Web.Config你已有的.所有这一切都告诉IIS在没有扩展名的情况下在Web.Configmets类型所在的目录中咳嗽文件,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>
Run Code Online (Sandbox Code Playgroud)