{"id":10242,"date":"2026-08-31T08:19:18","date_gmt":"2026-08-31T07:19:18","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=10242"},"modified":"2026-08-31T08:19:20","modified_gmt":"2026-08-31T07:19:20","slug":"c-webhost-is-obsolete","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/c-webhost-is-obsolete\/","title":{"rendered":"C# &#8216;WebHost&#8217; is obsolete"},"content":{"rendered":"\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"plain_text\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">warning ASPDEPR008: 'IWebHost' is obsolete: 'IWebHost is obsolete. Use IHost instead. For more information, visit https:\/\/aka.ms\/aspnet\/deprecate\/008.' (https:\/\/aka.ms\/aspnet\/deprecate\/008)\n\nwarning ASPDEPR008: 'WebHost' is obsolete: 'WebHost is obsolete. Use HostBuilder or WebApplicationBuilder instead. For more information, visit https:\/\/aka.ms\/aspnet\/deprecate\/008.' (https:\/\/aka.ms\/aspnet\/deprecate\/008)\n\nwarning ASPDEPR008: 'IWebHostBuilder.Build()' is obsolete: 'IWebHost is obsolete. Use IHost instead. For more information, visit https:\/\/aka.ms\/aspnet\/deprecate\/008.' (https:\/\/aka.ms\/aspnet\/deprecate\/008)\n<\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Original code:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"csharp\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">namespace WebApi\n{\n    public class Program\n    {\n        public static void Main(string[] args)\n        {\n            BuildWebHost(args).Run();\n        }\n\n        public static IWebHost BuildWebHost(string[] args)\n        {\n            return WebHost.CreateDefaultBuilder(args)\n                .UseStartup&lt;Startup>()\n                .Build();\n        }\n    }\n}<\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Code to use:<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"csharp\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">using Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\n\nnamespace WebApi\n{\n    public class Program\n    {\n        public static void Main(string[] args)\n        {\n            CreateHostBuilder(args).Build().Run();\n        }\n\n        public static IHostBuilder CreateHostBuilder(string[] args) =>\n            Host.CreateDefaultBuilder(args)\n                .ConfigureWebHostDefaults(webBuilder =>\n                {\n                    webBuilder.UseStartup&lt;Startup>();\n                });\n    }\n}\n\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Original code: Code to use:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10242","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=10242"}],"version-history":[{"count":1,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10242\/revisions"}],"predecessor-version":[{"id":10243,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/10242\/revisions\/10243"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=10242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=10242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=10242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}