简体   繁体   中英

Testing Azure Durable Functions locally returns an error about authentication handlers

I've been playing around with Durable Functions in .NET, following this basic guide: https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-create-first-csharp?pivots=code-editor-vscode

I get it all set up, and the function seems to be running normally (I get results), but when I attempt to query the status of the function I get the following error:

An unhandled host error has occurred. [2021-12-14T11:03:44.595Z] Microsoft.AspNetCore.Authentication.Core: No authentication handlers are registered. Did you forget to call AddAuthentication().AddSomeAuthHandler?.

Ive been looking around for what might be a solution to this, but can't seem to find a solution that works for me. I assume an ArmToken is related to Azure Resources, but in the guide they don't mention needing to set that up. Am I missing something?

Just in case anyone else comes upon this error and is a little stumped, here some extra info:

This happens if you integrate any library or project that has a dependency on ASP.NET Core Authentication middleware into the functions project. In our case, we were using the IdentityModel.AspNetCore Nuget library in a project referenced by the Functions project. IdentityModel.AspNetCore depends on the Oidc Middleware of ASP.NET Core and somewhere during its registration it calls AddAuthentication(...) to register services. But because that Middleware has a lot of dependencies on stuff that comes from ASP.NET Core, it just won't work in a functions runtime without a lot of extra work. So you might need to find the culprit library or project and remove it as a dependency or split stuff, then the error should go away.

For more details on the function integration problem with the specific library I mentioned, you can refer to: https://github.com/IdentityModel/IdentityModel.AspNetCore/issues/110

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM