asp.net-core-3.0

How can I fix email confirmation - in .NET Core, it doesn't work

本小妞迷上赌 提交于 2020-04-16 04:05:33
问题 I already have a register action public async Task<IActionResult> OnPostAsync(string returnUrl = null) { var useremail = _userManager.Users.FirstOrDefault(u => u.Email.ToLower() == Input.Email.ToLower()); if (useremail == null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if (ModelState.IsValid) { var user = new IdentityUser { UserName = Input.UserName, Email = Input.Email }; var result = await

Cannot list Entity Framework Migrations in Visual Studio 2019 due to dotnet ef dbcontext --json failure

别说谁变了你拦得住时间么 提交于 2020-04-15 21:55:48
问题 I have an ASP.NET Core 3.0 project that uses .NET Core 3.0. I have recently upgraded VS 2019 to version 16.4.1. I use Web Publish from Visual Studio to deploy the application on various environments, but this failed after the upgrade due to EF migrations (trying to find the db contexts failed): dotnet ef dbcontext --json failure Run "dotnet tool restore" to make the "dotnet-ef" command available. I tried to understand what is wrong. dotnet tool restore Cannot find a manifest file. For a list

how to migrate dotnet core 2.2 webapi to dotnet core 3.0

雨燕双飞 提交于 2020-04-14 07:38:11
问题 I was following this guide in here https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#mvc-service-registration but failed, so I create a new project with .net 2.2 (empty and fresh one with just one controller) then trying to migrate to 3.0. And I have failed again, especially in Startup.cs, the DI cannot detect method services.AddMvc(); It seems my code still refer to .net 2.2 instead of to .net 3.0 if I run .net watch run I got this error:

how to migrate dotnet core 2.2 webapi to dotnet core 3.0

假如想象 提交于 2020-04-14 07:38:09
问题 I was following this guide in here https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio#mvc-service-registration but failed, so I create a new project with .net 2.2 (empty and fresh one with just one controller) then trying to migrate to 3.0. And I have failed again, especially in Startup.cs, the DI cannot detect method services.AddMvc(); It seems my code still refer to .net 2.2 instead of to .net 3.0 if I run .net watch run I got this error:

How to correctly resolve services to use in the ConfigureServices() in ASP.NET Core 3.1?

帅比萌擦擦* 提交于 2020-04-13 07:04:50
问题 I have an ASP.NET Core 3.1 based app. During the app startup, in the ConfigureServices(IServiceCollection services) I want to register my services. But during configuring services, I want to boot the app based on settings found in the database. Here is my code public void ConfigureServices(IServiceCollection services) { // Register context services.AddDbContext<AppDbContext>(options => { options.UseMySql(Configuration.GetConnectionString("MySqlServerConnection")); }); // Reister the setting

How to define an endpoint Route to multiple Areas

独自空忆成欢 提交于 2020-04-10 14:43:40
问题 I am trying to define a MapAreaControllerRoute that routes to multiple Areas, but in 3.0 there is the areaName: property that needs to be set. I don't understand how I can use ONE route to be valid for multiple Areas. I have read through many issues here, but it seems that this is a new thing to MVC Core 3.0. In MVC Core <= 2.2 you could create a MapRoute without defining a set areaName. As it is now, in Startup.cs I define my endpoints as: app.UseEndpoints(endpoints => { endpoints

How to define an endpoint Route to multiple Areas

回眸只為那壹抹淺笑 提交于 2020-04-10 14:43:28
问题 I am trying to define a MapAreaControllerRoute that routes to multiple Areas, but in 3.0 there is the areaName: property that needs to be set. I don't understand how I can use ONE route to be valid for multiple Areas. I have read through many issues here, but it seems that this is a new thing to MVC Core 3.0. In MVC Core <= 2.2 you could create a MapRoute without defining a set areaName. As it is now, in Startup.cs I define my endpoints as: app.UseEndpoints(endpoints => { endpoints

Can't create new .NET Core 3.1 web app in Azure under Windows operating system

旧街凉风 提交于 2020-03-23 15:41:14
问题 I spent many hours trying to find some way to create a new .NET Core 3.1 web app under Windows subscription. I found that if you pick up the Runtime stack as .Net Core 3.1 (LTS) the only option is to create an app under the Linux. I tried to play with different regions and Sku and sizes as well but for all cases, it's just the same. There is no option to configure App Insight during the creation time either when using the Linux. The interesting thing is that when I created the Web App under

Can't create new .NET Core 3.1 web app in Azure under Windows operating system

一世执手 提交于 2020-03-23 15:39:08
问题 I spent many hours trying to find some way to create a new .NET Core 3.1 web app under Windows subscription. I found that if you pick up the Runtime stack as .Net Core 3.1 (LTS) the only option is to create an app under the Linux. I tried to play with different regions and Sku and sizes as well but for all cases, it's just the same. There is no option to configure App Insight during the creation time either when using the Linux. The interesting thing is that when I created the Web App under

.Net Core 3 IStringLocalizer.WithCulture(CultureInfo) is obsolete

被刻印的时光 ゝ 提交于 2020-03-21 11:34:11
问题 I've upgraded a project from .Net Core 2.2 to .Net Core 3.0. After trying to fix all the warnings and errors I'm now trying to fund a solution to this warning: 'IStringLocalizer.WithCulture(CultureInfo)' is obsolete: 'This method is obsolete. Use `CurrentCulture` and `CurrentUICulture` instead.' I'm using this to change the website language per the logged-in user. I have this implementation to change the website culture per user: public class CultureLocalizer : ICultureLocalizer { private