{"id":110,"date":"2019-09-16T04:58:59","date_gmt":"2019-09-16T04:58:59","guid":{"rendered":"http:\/\/sumitjangid.com\/?p=110"},"modified":"2019-09-16T04:58:59","modified_gmt":"2019-09-16T04:58:59","slug":"app-can-not-start-after-azure-deployment","status":"publish","type":"post","link":"http:\/\/sumitjangid.com\/index.php\/2019\/09\/16\/app-can-not-start-after-azure-deployment\/","title":{"rendered":"App can not start after azure deployment"},"content":{"rendered":"\n<p>Some times the apps didn&#8217;t work after we deploy it on azure and it shows errors like this:<br>App cannot be started<br>.NET Core 4.6.27817.03 X86 v4.0.0.0 \u00a0\u00a0\u00a0|\u00a0\u00a0\u00a0Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 \u00a0\u00a0\u00a0|\u00a0\u00a0\u00a0 Microsoft Windows 10.0.14393\u00a0<br><br>try the following fixes:<\/p>\n\n\n\n<p>First try and fix the program.cs file<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public static void Main(string[] args)\n        {\n            var webHost = new WebHostBuilder()\n        .UseKestrel()\n        .UseContentRoot(Directory.GetCurrentDirectory())\n        .ConfigureAppConfiguration((hostingContext, config) =>\n        {\n            var env = hostingContext.HostingEnvironment;\n            config.AddJsonFile(\"appsettings.json\", optional: true, reloadOnChange: true)\n                  .AddJsonFile($\"appsettings.{env.EnvironmentName}.json\",\n                      optional: true, reloadOnChange: true);\n            config.AddEnvironmentVariables();\n        })\n        .ConfigureLogging((hostingContext, logging) =>\n        {\n            \/\/ Requires using Microsoft.Extensions.Logging;`\n            logging.AddConfiguration(hostingContext.Configuration.GetSection(\"Logging\"));\n            logging.AddConsole();\n            logging.AddDebug();\n            logging.AddEventSourceLogger();\n        })\n        .UseStartup&lt;Startup>()\n        .Build();\n            webHost.Run();\n            \/\/ CreateWebHostBuilder(args).Build().Run(); \/\/This is the only line that you will find in the main function by default. so comment it and use the above code.\n        }\n\n<\/code><\/pre>\n\n\n\n<p>Kindly note that such changes to your code will change the configuration files, so check your code for such issues.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some times the apps didn&#8217;t work after we deploy it on azure and it shows errors like this:App cannot be started.NET Core 4.6.27817.03 X86 v4.0.0.0 \u00a0\u00a0\u00a0|\u00a0\u00a0\u00a0Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 \u00a0\u00a0\u00a0|\u00a0\u00a0\u00a0 Microsoft Windows 10.0.14393\u00a0 try the following&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,5,2],"tags":[],"_links":{"self":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/110"}],"collection":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":1,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":111,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/posts\/110\/revisions\/111"}],"wp:attachment":[{"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sumitjangid.com\/index.php\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}