相关疑难解决方法(0)

IIS Express 配置中的 allowdoubleescaping = "true" 不起作用

我收到 HTTP错误 404.11 - 未找到请求过滤模块配置为拒绝包含双转义序列的请求。 当我向 Blazor 中的 .razor 页面发送请求时出错,链接是动态构建的并发送到用户电子邮件:

string confirmationLink = $"{HttpContext.Request.Scheme}://{Request.Host}/account/confirmemail/{System.Web.HttpUtility.UrlEncode(user.Id)}/{System.Web.HttpUtility.UrlEncode(confirmationToken)}";
Run Code Online (Sandbox Code Playgroud)

我在五个地方修改了 IIS Express 配置文件:

  • “C:\Windows\System32\inetsrv”中的 web.config
  • “C:\Program Files\IIS Express\AppServer”中的 applicationhost.config
  • “C:\Program Files\IIS Express\config\templates\PersonalWebServer”中的 applicationhost.config
  • “C:\Program Files (x86)\IISExpress\AppServer”中的 applicationhost.config
  • “C:\Program Files(x86)\IIS Express\config\templates\PersonalWebServer”中的 applicationhost.config

在所有情况下,我都修改了

<requestFiltering allowDoubleEscaping="true">
Run Code Online (Sandbox Code Playgroud)

“web.server”“安全”部分中的标记。但我仍然收到错误。有什么解决办法吗?

visual-studio iis-express blazor

5
推荐指数
1
解决办法
1094
查看次数

允许在 IIS/Azure 中的 ASP.NET Core 的 URL 中使用冒号 (:)

我有一个正在部署到 Azure 的 ASP.NET Core 应用程序,该应用程序在 URL 中接收包含冒号(时间戳)的字符串。

例如:http://localhost:5000/Servers/208.100.45.135/28000/2017-03-15T07:03:43+00:00,或http://localhost:5000/Servers/208.100.45.135/28000/2017-03-15T07%3a03%3a43%2B00%3a00URL 编码。

使用 Kestrel ( ) 在本地运行时效果非常好dotnet run,但在部署到 Azure 后我收到此错误:The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

快速搜索发现,这是由于 URL 中使用了无效字符(即冒号)造成的。传统的修复方法是将此部分添加到web.config

 <system.web>
     <httpRuntime requestPathInvalidCharacters="" />
 </system.web>
Run Code Online (Sandbox Code Playgroud)

但是,将其添加到 Azure 上的 web.config 后,我发现没有任何变化。我想这是由于 ASP.NET Core 托管模型的差异造成的。

这是我目前的web.config

<configuration>
    <system.web>
        <httpRuntime requestPathInvalidCharacters=""/>
        <pages validateRequest="false" />
    </system.web>
    <system.webServer>
        <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
        </handlers> …
Run Code Online (Sandbox Code Playgroud)

asp.net iis azure asp.net-core

3
推荐指数
1
解决办法
3900
查看次数

标签 统计

asp.net ×1

asp.net-core ×1

azure ×1

blazor ×1

iis ×1

iis-express ×1

visual-studio ×1