-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.AspNetCore.DataProtection - IOC error #5447
Comments
We don't allow you to register any Without doing some research I don't know whether we should open this class up or not to allow it to be used -- @fabiocav any ideas here? |
We can discuss the options (which could also mean adding that as an optional service), but it will indeed require a bit of investigation to understand the impact. |
can I help somehow? |
Also, please do you have any idea about how to use a 2.2 version of Microsoft.AspNetCore.DataProtection in v3 function for now? Because the function runner is trying to use 3.1 of Microsoft.AspNetCore.DataProtection version from func.exe folder, regardless of what nuget package of DataProtection I use. |
@petrce 3.0 unifies on framework dependencies for .NET Core 3.1, that's not something you'd have the ability to override. Allowing this dependency to register a hosted service shouldn't be an issue, we'll keep you updated here. |
This seems like an example of the same kind of problem but with healthchecks, which also wants to register an |
Why not? |
@Tratcher allowing custom logic (potentially background services) to run outside of the context of a function is not something we can promote as supported today because of a few issues. The top ones being:
Those are solvable problems, but problems that exist today. Until we can invest on the changes required to properly support registration of custom hosted services and ensure a good experience, we intend to keep this restriction in place. |
Wow, so that means that in foreseeable future there is no way to make Microsoft.AspNetCore.DataProtection working in Azure Function v3? that is really a bummer for me :( so I will have to migrate my APIs to different data protection if I want to use the .NET Core 3 |
Surely this should be listed in https://docs.microsoft.com/en-us/dotnet/core/compatibility/2.2-3.1 ? - the only mentionto data protection is about a change in storage namespace but this breaks our application totally. :-( |
@zebslc this is a Functions specific limitation. |
In which case it could have been in there with brackets ( |
Also ran into this issue when trying to migrate to v3. I am registering RazorPages/RazorViewEngine which registers the DataProtection library. |
same here @LukeKolodziej . Any updates on this? |
Also, looks like |
|
@fabiocav Can you special case that concrete type? https://github.com/dotnet/aspnetcore/blob/6255c1ed960f5277d2e96ac2d0968c2c7e844ce2/src/DataProtection/DataProtection/src/Internal/DataProtectionHostedService.cs#L35 This will at least unblock people for now while we figure out what a longer term solution looks like. |
@espray I can say for sure that it didn't throw an exception on startup |
@Leon99 correct it wont exception at startup, it will fail when trying to service the http request |
Any update on this issue? I just need to implement AAD role based authentication in Azure function v3 but when calling AddAuthentication never works failed with HostService error. If there is any other solutions for AAD role based authentication in AzFunctions v3 let me know |
I was able fix this issue while using IWebJobsStartup instead of FunctionsStartup. The issue seems to be IFunctionsHostBuilder in the DI container. So this might work with this line of code in Startup.cs public class Startup : IWebJobsStartup
} In order to resolve dependencies you need to use third party DI container and I used Willezone.Azure.WebJobs.Extension. |
For those implicitly using the DataProtectionHostedService i.e. by using AddIdentity or similar you can remove it by using this line after builder.Services.Remove(builder.Services.First(x => x.ImplementationType?.Name == "DataProtectionHostedService")); This works around the issue for my use case, but this definitely needs a proper solution as this is an undocumented breaking change between V2 and V3, nothing about it on the migration guide. |
Just an update on this. We'll be removing this restriction for data protection. @brettsam can share more information if needed, but this restriction will be lifted in the release for the current sprint (set to begin at the end of next week) |
@fabiocav When does the sprint end? I.E, when would this fix be release? Just wondering if I should hold out and wait and work on other things in the mean time. |
With this i got it working on my computer (emulator), but not in Azure :( |
@andresrsanchez same, but the function seems to be running anyway - see if that's the case for you too! |
|
@MattJeanes ok i see now, it isnt executing in my case :( |
Can you post the full error? I have something similar, see below. |
@dancundy sadly that's the full error :( |
Hi so it works now and this issue can be closed? |
Yes it looks like this is now deployed to production -- I don't believe that the core tools (or VS tools) have been updated yet but that will be coming soon. |
Are there any prerelease builds of core tools that could be used yet for this? |
The original issue has been fixed Azure/azure-functions-host#5447 (comment) dotnet#16581 dotnet#17037
The original issue has been fixed Azure/azure-functions-host#5447 (comment) #16581 #17037
After updating my function to v3 I get this error on startup:
This is my current setup:
And this is my .csproj
Startup.cs file:
It was definitely working in 2.2
Downgrading Microsoft.AspNetCore.DataProtection packages do not help.
Running from VS or in the command line returns the same error.
The only solution is to do not upgrade to the v3 function app :(
The text was updated successfully, but these errors were encountered: