我使用 Azure 存储和 CDN 以及 Microsoft 标准定价层创建了一个静态页面。我需要将用户从(使用 www)重定向example.com到https://www.example.com(使用 www),但我的规则似乎不起作用 - 只有 http 到 https 重定向规则有效,所以当我输入时example.com我被重定向到https://example.com
这是我的规则配置:
我正在阅读一本“Asp.net Core 3 和 Angular 9”书,其中有一个 .NET Core 运行状况检查的示例用法。Microsoft 网站上也对此进行了描述:https://learn.microsoft.com/en-US/aspnet/core/host-and-deploy/health-checks ?view=aspnetcore-3.0 我找不到实际使用的理由它不仅仅是在某个控制器中创建一条将 ping 外部地址的路由。
书上的代码是这样的:
Configure在(Startup.cs) 方法中添加以下内容:
app.UseHealthChecks("/hc", new CustomHealthCheckOptions());
Run Code Online (Sandbox Code Playgroud)
ConfigureServices方法:
services.AddHealthChecks()
.AddCheck("ICMP_01", new ICMPHealthCheck("www.ryadel.com", 100))
.AddCheck("ICMP_02", new ICMPHealthCheck("www.google.com", 100))
.AddCheck("ICMP_03", new ICMPHealthCheck("www.does-notexist.com", 100));
Run Code Online (Sandbox Code Playgroud)
创建 ICMPHealthCheck.cs 文件:
using Microsoft.Extensions.Diagnostics.HealthChecks;
using System;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
namespace HealthCheck
{
public class ICMPHealthCheck : IHealthCheck
{
private string Host { get; set; }
private int Timeout { get; set; }
public ICMPHealthCheck(string host, int timeout)
{
Host …Run Code Online (Sandbox Code Playgroud)