4
votes

I am trying to migrate my asp.net core 1.0.0 RC1 application to final 1.0.0 and with the help of other posts I managed to change all references from RC1 to final 1.0.0 But still there are couple of errors remains which I cant find suitable replacement methods or references

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

Error CS1061 'IApplicationBuilder' does not contain a definition for 'UseIISPlatformHandler' and no extension method 'UseIISPlatformHandler' accepting a first argument of type 'IApplicationBuilder' could be found (are you missing a using 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' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)

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

Please could anyone help me to resolve these? Thanks in advance.

1
I recommend create a new web application with individual user accounts and then compare the new project to your current one to see what has changed. in the latest you will get a Program.cs file and the IIS integration goes there rather than in startupJoe Audette

1 Answers

7
votes

For first issue,

remove app.UseIISPlatformHandler line and add UseIISIntegration() in Main method like 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 second issue,

Use services.AddEntityFrameworkSqlServer() instead of services.AddEntityFramework().AddSqlServer()

References:

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

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

See if this helps.