identityServer的“为https配置”的客户端编写

以往进行identityServer客户端编写时,编写客户端为控制台程序,故identityServer无需勾选为https配置这一选项。
identity控制台程序(无:为https配置)

在这里插入图片描述

而当引入quickStartUI后,这一切又有哪些不同呢?

IISExpress版IdentityServer教程

参考链接:identityServer教程文档

注意:

IISExpress?

参考链接:IISExpress总结

当我们打开properties文件夹中的launchSettings.json时,会发现一些IISE端口,当更改这些端口时,很容易就会在运行项目时,发生:要访问的计算机积极拒绝连接、连接失败等问题。
创建.net文件时,自带IISExpress。这也是是否勾选https配置的基本区别。
注意:IIS Express 默认只支持本地连接,不能用ip去访问。
在这里插入图片描述

identityServer的创建

在创建时需要勾选:为https配置,这一选项(通常为默认配置)
在这里插入图片描述

其余方法与先前一致。代码不同点为:

 public void Configure(IApplicationBuilder app)
 {
     if (Environment.IsDevelopment())
     {
         app.UseDeveloperExceptionPage();
     }

     // uncomment if you want to add MVC
     //app.UseStaticFiles();
     //app.UseRouting();

     app.UseIdentityServer();

     // uncomment, if you want to add MVC
     //app.UseAuthorization();
     //app.UseEndpoints(endpoints =>
     //{
     //    endpoints.MapDefaultControllerRoute();
     //});
 }


 //public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 //{
 //    if (env.IsDevelopment())
 //    {
 //        app.UseDeveloperExceptionPage();
 //    }

 //    app.UseRouting();
 //    app.UseIdentityServer();

 //    app.UseEndpoints(endpoints =>
 //    {
 //        endpoints.MapGet("/", async context =>
 //        {
 //            await context.Response.WriteAsync("Hello World!");
 //        });
 //    });
 //}

此后,如果我们按照教程:参考教程:添加quickstartUI 安装quickstartUI后,会出现可视化页面。
(一个很好看的UI页面,而不是以往的hello world!)

创建identityServer的MVC客户端

此前,我们所创建的项目为控制台项目。当我们定义了IdentityServer服务器端为MVC模式后,客户端也必须是MVC模式,否则会出现错误:{“error”: “invalid_scope”}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值