RC1 source errors to 1.0.0 for ASP.NET

I am trying to port an asp.net core 1.0.0 RC1 application to final 1.0.0 and with the help of other messages I managed to change all the links from RC1 to final 1.0.0 But there are still a few errors that I cannot find suitable replacement methods or links

app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());

Error CS1061 "IApplicationBuilder" does not contain a definition for "UseIISPlatformHandler" and no extension method 'UseIISPlatformHandler' accepts the first argument of the type 'IApplicationBuilder' can be found (do you miss a directive or an assembly reference?)

I have "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0"in project.json

services.AddEntityFramework().AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

Error CS1061 'IServiceCollection' does not contain a definition for 'AddEntityFramework' and no extension method 'AddEntityFramework' can take the first argument of the type "IServiceCollection" (do you miss the using directive or assembly reference?)

I have "Microsoft.EntityFrameworkCore": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",in project.json

Please help me solve this problem? Thanks in advance.

+4
source share
1 answer

For the first problem

delete the line app.UseIISPlatformHandlerand add UseIISIntegration()to the main method as shown below -

public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()    // Replaces call to UseIISPlatformHandler
                .UseStartup<Startup>()
                .Build();


            host.Run();
        }

For the second problem

Use services.AddEntityFrameworkSqlServer()insteadservices.AddEntityFramework().AddSqlServer()

Literature:

ASP.NET 5 RC1 ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc1-to-rtm.html

ASP.NET Core RC2 ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc2-to-rtm.html

, .

+6

Source: https://habr.com/ru/post/1649620/


All Articles