ASPNetCore MVC Routing Let Server Handle Specific Route

我怕爱的太早我们不能终老 提交于 2019-12-11 00:16:00

问题


This is a fork of a previous, unresolved question

On a remote web host, I am a user. It is a shared hosting environment. The host uses Plesk, and I am trying to fix my AspNetCore application to allow Let's Encrypt's installation and automatic renewal.

I am positive the AspNetCore application is interfering with the Let's Encrypt installation and automatic renewal, since I can create an empty site and install Let's Encrypt certs with no trouble, and when I create a fresh site with a 'quickstart' AspNetCore application, the installation and renewal fails.

I suspect the host may be configured to route all requests to a ./well-known/ directory to a virtual directory that I do not have access to (waiting on a response from the host).

All of the solutions I have been directed to, or provided required some form of administrative access to the server, which is not a solution in my case. I am a user.

One of the solutions was to configure the route, and have the application serve the requested challenge key. Since I do not have access to the (possibly) aliased directory, I cannot have MVC handle the route in this manner.

The only thing I can think of, is to somehow configure MVC routes, so that when it receives a request for /.well-known/ is to pass the request on to the server. A literal pass through route, to ensure MVC routing does not interfere, does not do anything, but does not stop the request and only lets the server handle the request. Is this possible?


回答1:


The host found the solution. This was a IIS configuration thing.

In directory ./.well-known/ create a file named web.config

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <remove name="aspNetCore" />
        </handlers>
    </system.webServer>
</configuration>

I'm not sure exactly what this does, but it looks like it excludes aspNetCore from processing any calls to that directory.



来源:https://stackoverflow.com/questions/44874279/aspnetcore-mvc-routing-let-server-handle-specific-route

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!