我有一个Asp.Net Core 2.0 WebApi,它针对AAD进行身份验证:
services.AddAuthentication(options => { options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; })
.AddJwtBearer(options =>
{
options.Authority = "https://login.microsoftonline.com/TENANT.onmicrosoft.com";
options.Audience = "CLIENT_ID";
});
Run Code Online (Sandbox Code Playgroud)
我的SPA应用程序从AAD获取令牌并将其作为bearer
标头发送.一切正常.
我在Azure Scheduler中创建了一个Job并进行了设置Active Directory OAuth
:
在运行一个工作后,我得到了这个错误:Bearer error="invalid_token", error_description="The audience is invalid"
.
当我设置options.Audience
的AddJwtBearer(...)
,以https://management.core.windows.net/
作业的作品,但不是SPA.
我想,我需要设置Audience
一个数组['CLIENT_ID', "https://management.core.windows.net/"]
但是options.Audience
类型是string
.如果我没有设置Audience
,Spa和Job都不起作用(401未经身份验证).设置Audience
到CLIENT_ID,https://management.core.windows.net/
也不行.
有没有办法如何启用多个受众AddJwtBearer
?
我正在使用 XDebug(PHP Debug
扩展)在 VS Code 中调试 PHP 应用程序并收到如下错误:
我知道问题是什么以及如何解决它,但解决方案是如此庞大,以至于我目前无法解决此类错误。
我想开始使用 VS Code 进行 PHP 开发。我将 Visual Studio 与“用于 Visual Studio 的 PHP 工具”一起使用,但没有出现此问题。
在请求发生时加载的第一个脚本中,我有error_reporting(E_ALL^E_WARNING^E_NOTICE);
,它应该抑制这样的错误。但似乎 VS Code 调试器忽略了它。我没有找到任何PHP Debug
可以帮助我解决这个问题的设置。
有什么方法可以告诉 VS Code Debugger 忽略/不显示此类错误?
是否可以__EFMigrationsHistory
在EntityFramework Core中更改表的架构?
如何使用EF Core(7)批量更新实体?
我不想从数据库服务器加载实体,修改属性和更新.我只想要EF生成适当的UPDATE语句.
我有一个Asp.NET Core应用程序,没有特殊的DataProtection堆栈设置 - 只是AddMvc.虽然一切都适用于IISExpress /(Kestrel),但在IIS服务器上我遇到了这个错误:
11/23/2016 18:50:14:warn: Microsoft.AspNetCore.Session.SessionMiddleware[7]
Error unprotecting the session cookie.
System.Security.Cryptography.CryptographicException: The key {6d00462a-ba7f-4f65-bb36-711605de93f2} was not found in the key ring.
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
11/23/2016 19:27:34:warn: Microsoft.Extensions.DependencyInjection.DataProtectionServices[59]
Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
11/23/2016 19:27:34:warn: Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository[50]
Using an in-memory repository. …
Run Code Online (Sandbox Code Playgroud) 如何在VSO部署模板中设置ASPNETCORE_ENVIRONMENT变量?
我有一个Asp.Net核心应用程序,可以在IIS中托管或作为WindowsService.
这是Program.cs的一部分
public static class Program
{
public static void Main(string[] args)
{
var hostAsWindowsService = !args.Contains("--web");
var contentRoot = hostAsWindowsService ? Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) : Directory.GetCurrentDirectory();
var config = new ConfigurationBuilder()
.SetBasePath(contentRoot)
.AddJsonFile("host.json")
.AddCommandLine(args)
.AddEnvironmentVariables()
.Build();
var environment = config["environment"];
var urls = config["server.urls"];
var certificateFilename = config["certificate.filename"];
var certificatePassword = config["certificate.password"];
var hostConfig = new WebHostBuilder()
.UseConfiguration(config)
.UseUrls(urls)
.UseContentRoot(contentRoot)
.UseKestrel(options =>
{
if (!string.IsNullOrWhiteSpace(certificateFilename))
{
options.UseHttps(contentRoot + certificateFilename, certificatePassword);
}
})
.UseStartup<Startup>();
if (!string.IsNullOrWhiteSpace(environment))
{
hostConfig.UseEnvironment(environment);
}
if (hostAsWindowsService)
{ …
Run Code Online (Sandbox Code Playgroud) 我确实试过这两个模板:
https://github.com/asadsahi/AspNetCoreSpa
https://github.com/MarkPieszak/aspnetcore-angular2-universal
但在这两种情况下最终都出现了不起作用的东西.
我只是想知道是否有可能以某种方式在.net核心上运行AngularCLI?"我是Angular的新手,请耐心等待.
我正在寻找能给我带来AOT,DLL,TreeShaking等所有糖果的东西,我的身边配置了最小/零配置.
asp.net-core ×3
iis ×3
azure-devops ×2
deployment ×2
angular ×1
asp.net ×1
c# ×1
jwt ×1
php ×1
tfs ×1
xdebug ×1