app.UseHsts() 和 app.UseExceptionHandler() 有什么区别? [英] What is the difference between app.UseHsts() and app.UseExceptionHandler()?

查看:52
本文介绍了app.UseHsts() 和 app.UseExceptionHandler() 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 .NET Core 应用程序的 Startup.cs 文件中,默认使用

On the Startup.cs file of an .NET Core app, by default it make use of

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseHsts();
        }

但在某些情况下我可以找到

But in some cases I can find the use of

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler();
        }

有什么区别?

推荐答案

Hsts 是强制 SSL 的安全功能.它与异常无关.

Hsts is a security feature to force SSL. It has nothing to do with exceptions.

这篇关于app.UseHsts() 和 app.UseExceptionHandler() 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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