migrating asp.net core 1.0 to 2.0


To migrate, you need code change

Code change

Net Core 1.0

            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseStartup().UseUrls("http://localhost:5050")
                .UseApplicationInsights()
                .Build();
           
            host.Run();


Net Core 2.0

         BuildWebHost(args).Run();

        public static IWebHost BuildWebHost(string[] args)
       => WebHost.CreateDefaultBuilder(args).CaptureStartupErrors(true)
         .UseStartup()
         .Build();


Nuget packages update 

We need to upgrade all the nuget packages - which include Application.Insights, Microsoft.AspNetCore and EntityFramework. 


Window Hosting Bundle

Install Windows Hosting Bundle 2.0 and above.


Potential Error that you might see are :-


Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider'

The library hostpolicy.dll was not found  - This has to do with your application compile and targeted for 2.0 but does not have the runtime configure on the server side (IIS) 

Code still in 1.0 instead of 2.0  - you might get error "Process cannot be started" when trying to run on server with .net 2.0 runtime installed. 








Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm