Azure应用服务|将应用程序目标部署到同一应用程序服务中的.NET Framework和.NET Core [英] Azure App Service | Deploy apps targets to.NET framework and .NET core in same app service

查看:70
本文介绍了Azure应用服务|将应用程序目标部署到同一应用程序服务中的.NET Framework和.NET Core的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将.NET Framework 4.7配置为应用程序服务.我已在App服务上启用身份验证选项,并配置为使用Azure Active Directory登录".我已经在Azure活动目录中注册了应用.

I have app service configured with .NET framework 4.7. I have enabled authentication option on App service and configured to "Log in with Azure Active Directory".  I have registered app with Azure active directory. 

具有.net框架的Web应用程序可以正常工作,即,我受到AAD的挑战,输入凭据,然后进入应用程序.但是对于.NET核心,我受到AAD(EasyAuth)的挑战,但是.NET核心没有设置用户上下文.

Web apps with .net framework work fine i.e. I get challenged by AAD I enter my credentials and I get into app. But for .NET core I get challenged by AAD (EasyAuth) however .NET core does not have user context set.

我未通过身份验证就部署了两个应用程序.对于asp.net核心,我得到了

I deployed both apps with no authentication. For asp.net core I get 

InvalidOperationException:否指定了authenticationScheme,没有找到DefaultChallengeScheme

后续文章 https://www.benday.com/2018/05/17/walkthrough-part-4-azure-app-service-authentication-with -混合了公共和受保护的ASP-NET核心MVC页//

但是文章谈到了更改Azure中的安全设置以允许匿名,这是我不想做的.

But articles speaks about Changing the Security Settings In Azure to Allow Anonymous, which I dont want to do. 

有效的方法是,如果我关闭身份验证或设置允许匿名,并向asp.net和asp.net核心Web应用程序都添加开放ID连接nuget程序包,我将受到挑战并显示应用程序.

What works is if I switch off authentication or set allow anonymous and add open id connect nuget packages to both asp.net and asp.net core web apps, I get challenged and app gets displayed. 

基于此,我有几个问题:

Based on this I have couple of questions: 

1. Azure应用程序服务是否允许asp.net框架和asp.net核心与"EasyAuth"共存?启用了吗?

1. Does Azure app service allow asp.net framework and asp.net core to co-exist with "EasyAuth" enabled? 

2.如果是,如何将上下文传递给asp.net核心应用?

2. If yes, how to pass context to asp.net core app? 

非常感谢您的帮助.

此致

RK

Radhakrishna

Radhakrishna

推荐答案

对上述信息的更新.据我了解,即使Easy Auth对用户进行身份验证,它也没有为ASP.NET Core设置ClaimsPrincipal.Current.我们必须在控制器或中间件的ASP.NET核心中手动进行此操作

an Update to above information. From what I understand, even though Easy Auth authenticates users, it does not set ClaimsPrincipal.Current for ASP.NET core. We have to do it manually in ASP.NET core either in controller or middleware

我下载了zip 来自https://www.benday.com/2018/05/21/walkthrough-part-5-asp-net-core-claims-based-security-using-azure-app-authentication-the-auth-me-服务端点/

I downloaded zip  from https://www.benday.com/2018/05/21/walkthrough-part-5-asp-net-core-claims-based-security-using-azure-app-authentication-the-auth-me-service-endpoint/ 

并更新了安全控制器和PopulateMiddleware,以包含以下代码

and updated security controller and PopulateMiddleware to include following code 

但是,未为应用程序设置用户上下文.有人可以帮忙吗?

However, user context is not set for application. Can you anybody please help? 

此致

RK


这篇关于Azure应用服务|将应用程序目标部署到同一应用程序服务中的.NET Framework和.NET Core的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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