ich folgenden Tutorial gefunden habe, wie Form asp.net zu asp.net Kern migrieren Projekt auf Linux laufen: https://docs.microsoft.com/en-us/aspnet/core/migration/mvcMigration von asp.net zu asp.net Kern
Leider, wenn ich versuche zu „Configure Identität und Mitgliedschaft“ und ich bin Kopieren Code Projekt sieht aus wie es nicht solche Befehle für .net Kern sind
zum Beispiel dieser Teil:
Dann öffnen Startup.cs und Update Die ConfigureServices() -Methode für die Verwendung von Entity Framework und Identitätsdienste:
public void ConfigureServices(IServiceCollection services)
{
// Add EF services to the services container.
services.AddEntityFramework(Configuration)
.AddSqlServer()
.AddDbContext<ApplicationDbContext>();
// Add Identity services to the services container.
services.AddIdentity<ApplicationUser, IdentityRole>(Configuration)
.AddEntityFrameworkStores<ApplicationDbContext>();
services.AddMvc();
}
Die gleiche Situation ist für ApplicationUser.cs
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
namespace NewMvc6Project.Models
{
public class ApplicationUser : IdentityUser
{
}
}
und ApplicationDbContext.cs
using Microsoft.AspNetCore.Identity.EntityFramework;
using Microsoft.Data.Entity;
namespace NewMvc6Project.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
{
Database.EnsureCreated();
}
protected override void OnConfiguring(DbContextOptions options)
{
options.UseSqlServer();
}
}
}
Ist es falsch, Tutorial oder ich soll ein neues Paket installieren?
sagen Sie sich in Ihrem Start keine ConfigureService Methode ist ? Was ist dein Problem? –
Nein nein. Ich habe ConfigureService-Methode, aber im Moment weiß ich nicht, was in diesen Fällen zu tun: http://scr.hu/2aps/nrpyr http://scr.hu/2aps/g514u http: // scr. hu/2aps/ozpay http://scr.hu/2aps/29zjc – Halas
'Optionen.UseSqlServer();' und 'OnConfiguring' in' ApplicationDbContext' ist nicht erforderlich, entfernen Sie diese, versuchen, Visual Studio zu erstellen und neu zu starten sehen Sie, ob der Fehler verschwindet. – NucS