I tried to add ApiVersioning in ConfigureServices() method but got an error:
'IServiceCollection' does not contain a definition for 'AddApiVersioning' and no accessible extension method 'AddApiVersioning' accepting a first argument of type 'IServiceCollection' could be found...
Tried to install package Microsoft.AspNetCore.Mvc.Versioning 3.1.1 get new error:
Version conflict detected for Microsoft.AspNetCore.Authentication.Abstractions. Install/reference Microsoft.AspNetCore.Authentication.Abstractions 2.2.0 directly to project TM.DataCollector to resolve this issue.
TM.DataCollector -> Microsoft.AspNetCore.Mvc.Versioning 3.1.1 -> Microsoft.AspNetCore.Mvc.Core 2.2.0 -> Microsoft.AspNetCore.Authorization.Policy 2.2.0 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0)
TM.DataCollector -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.1.1 && < 2.2.0). TM.DataCollector C:\Users\Matej\Dropbox (HSI)\Development\InproTelemetrija\TM v.2\Solutions\TM.DataCollector\TM.DataCollector.csproj 1
Using .Net Core 2.1.1
What am i missing?!
You won't be able to use 3.1+ on ASP.NET Core 2.1 as it specifically targets 2.2. You probalby want to go back to 3.0. The only real difference between 3.0 and 3.1 is that 3.0 still targets 2.0, which allows you to use any version of ASP.NET Core 2.0+. 3.1 adds support for the _Endpoint Routing_ feature in ASP.NET Core 2.2. To use this feature, you obviously need to use 2.2+.
The two easily solutions are:
I hope that helps.
Awesome! Thank you for this info...
Console Application / Service - serviceProvider fails to get GetService
Works perfectly in another console application with the exact same code in it...wonder why ? :-P
@OneGenkiGirl73 Which service are you requesting? Is there something else about your configuration you can share?
There was nothing special about it, just a simple "controller" I called an ISiteController that does CRUD for a datatable. In the console application on my home computer it works perfectly.
I would think the serviceProvider.GetService
Sounds like something else is awry. Are you saying if you remove the call to services.AddApiVersioning(), then things work as normal?
I'm sorry, I meant to say the .GetService isn't working as it does with the other database controller I built on my other dev machine. I'm just wondering why the behavior would be different on the other machine with the exact same code...?
Sent from Yahoo Mail on Android
On Wed, Apr 15, 2020 at 9:39 PM, Chris Martineznotifications@github.com wrote:
Sounds like something else is awry. Are you saying if you remove the call to services.AddApiVersioning(), then things work as normal?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Most helpful comment
You won't be able to use 3.1+ on ASP.NET Core 2.1 as it specifically targets 2.2. You probalby want to go back to 3.0. The only real difference between 3.0 and 3.1 is that 3.0 still targets 2.0, which allows you to use any version of ASP.NET Core 2.0+. 3.1 adds support for the _Endpoint Routing_ feature in ASP.NET Core 2.2. To use this feature, you obviously need to use 2.2+.
The two easily solutions are:
I hope that helps.