web.config <location> 中带点的路径 [英] path with a dot in web.config &lt;location&gt;

查看:44
本文介绍了web.config <location> 中带点的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的 web.config 文件中添加一个 location 元素,但路径以一个点开头(而且我认为我无法更改该路径,它用于 letsencrypt 自动化).

I need to add a location element in my web.config file, but the path starts with a dot (and I don't think I can change that path, it's for letsencrypt automation).

如果我让点,就像在 </location> 中一样,该站点根本不会启动(我认为 web.config 文件根本没有被解析,因为我看到页面要求我配置 customErrors,但它已经配置并且通常工作正常)

If I let the dot, like in <location path=".well-known/acme-challenge"></location>, the site doesn't start at all (I think the web.config file is not parsed at all because I get the page asking me to configure customErrors, but it is already configured and usually works fine)

如果我删除点,就像在 <location path="well-known/acme-challenge"></location> 中一样,web.config 文件被正确加载,但是当然,这并不能帮助我在我希望的位置配置任何东西.

If I remove the dot, like in <location path="well-known/acme-challenge"></location> the web.config file is correctly loaded, but of course that doesn't help me to configure anything at the location I wish.

最终目标是仅在此路径上禁用基本身份验证(我对站点的其余部分都需要);我什至不知道我是否能够在 元素中设置它.

The final goal is to disable basic authentication (which I need for the rest of the site) on this path only ; I don't even know if I'll be able to set this up in a <location> element.

推荐答案

我有一个类似的问题,我有一个 ASP.NET Forms 站点,它强制对所有页面进行身份验证.

I had a similar problem where I had a ASP.NET Forms site that was forcing authentication on all pages.

为了扩展已接受的答案,这里是我放在 /.well-known 文件夹中的确切 web.config(不是 /.well-known/acme-challenge 文件夹):

To expand on the accepted answer, here is the exact web.config I put in the /.well-known folder (NOT the /.well-known/acme-challenge folder):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <!-- This will stop any redirects you have at the higher level -->
    <httpRedirect enabled="false" />

    <!-- This will stop any integrated mode settings you have at the higher level -->
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>

  <!-- This will allow unauthenticated users to acme-challenge subfolder -->
  <location path="acme-challenge">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>

添加此文件后,我可以使用 EcdsaAcmeNet 在 IIS 中的站点上使用 Lets Encrypt.

After adding this file, I was able to use EcdsaAcmeNet to use Lets Encrypt with the site in IIS.

这篇关于web.config <location> 中带点的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆