This of course gives me an error of required package 'Microsoft.AspNetCore.Server.IIS', And when I try to install it as suggested it fails and gives me this error:
Additional information: Package restore failed. Rolling back packagae changes for '<ProjectName>'
This error message means your Microsoft.AspNetCore.Server.IIS
package version is higher than your project version.Your project is asp.net core 2.1 but the package version is 2.2.6.They do not match with each other.
But another thing you need to know asp.net core 2.1 does not support windows authentication,that is to say,you could not using such code in asp.net core 2.1:
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
62 Points
178 Posts
Unable to add AddAuthentication for IIS in startup.cs
Nov 25, 2020 12:38 PM|musbah7@hotmail.com|LINK
Hi
I'm preparing my asp.net core 2.1 project to host on the Internet.
When I tried to put this line of code in Startup file:
This of course gives me an error of required package 'Microsoft.AspNetCore.Server.IIS', And when I try to install it as suggested it fails and gives me this error:
Installing 'Microsoft.AspNetCore.Server.IIS' failed
Additional information: Package restore failed. Rolling back packagae changes for '<ProjectName>'
Why? and how to solve please?
Contributor
4873 Points
4125 Posts
Re: Unable to add AddAuthentication for IIS in startup.cs
Nov 25, 2020 06:30 PM|DA924|LINK
You should have seen some kind of message as to why the DLL failed to install.
Member
62 Points
178 Posts
Re: Unable to add AddAuthentication for IIS in startup.cs
Nov 26, 2020 05:59 AM|musbah7@hotmail.com|LINK
Yes when I try to install it by Nuget Manager it returns thie error:
Version conflict detected for Microsoft.AspNetCore.Authentication.Abstractions. Install/reference Microsoft.AspNetCore.Authentication.Abstractions 2.2.0 directly to project MyProject to resolve this issue.
MyProject -> Microsoft.AspNetCore.Server.IIS 2.2.6 -> Microsoft.AspNetCore.Authentication.Core 2.2.0 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.2.0)
MyProject -> Microsoft.AspNetCore.App 2.1.1 -> Microsoft.AspNetCore.Authentication.Abstractions (>= 2.1.1 && < 2.2.0).
Contributor
2680 Points
874 Posts
Re: Unable to add AddAuthentication for IIS in startup.cs
Nov 26, 2020 06:57 AM|Rena Ni|LINK
Hi musbah7.hotmail.com,
This error message means your Microsoft.AspNetCore.Server.IIS package version is higher than your project version.Your project is asp.net core 2.1 but the package version is 2.2.6.They do not match with each other.
But another thing you need to know asp.net core 2.1 does not support windows authentication,that is to say,you could not using such code in asp.net core 2.1:
Reference:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.server.iis.iisserverdefaults.authenticationscheme?view=aspnetcore-5.0#moniker-applies-to
If you must using such authentication,please migrate from ASP.NET Core 2.1 to 2.2:
Reference:
https://docs.microsoft.com/en-us/aspnet/core/migration/21-to-22?view=aspnetcore-5.0&tabs=visual-studio
Best Regards,
Rena