{"id":574,"date":"2019-09-24T14:27:12","date_gmt":"2019-09-24T05:27:12","guid":{"rendered":"http:\/\/csharp.ihavenomoney.co.kr\/?p=574"},"modified":"2019-09-24T14:28:17","modified_gmt":"2019-09-24T05:28:17","slug":"hello-world-with-iapplicationlifetime","status":"publish","type":"post","link":"https:\/\/csharp.ihavenomoney.co.kr\/?p=574","title":{"rendered":"hello-world-with-IApplicationLifetime"},"content":{"rendered":"<pre class=\"lang:c# decode:true \" >using Microsoft.AspNetCore.Hosting; \/\/IWebHostBuilder\r\nusing Microsoft.AspNetCore.Builder; \/\/IApplicationBuilder\r\nusing Microsoft.AspNetCore.Http; \/\/WriteAsync\r\nusing Microsoft.AspNetCore; \/\/webHost\r\n\r\nnamespace WebApplication1\r\n{\r\n    public class Startup\r\n    {  \r\n        public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime)\r\n        {\r\n            lifetime.ApplicationStarted.Register(() =&gt; System.Console.WriteLine(\"===== Server is starting\"));\r\n            lifetime.ApplicationStopping.Register(() =&gt; System.Console.WriteLine(\"===== Server is stopping\"));\r\n            lifetime.ApplicationStopped.Register(() =&gt; System.Console.WriteLine(\"===== Server has stopped\"));\r\n\r\n            app.Run(async context =&gt;\r\n            { \r\n                await context.Response.WriteAsync(\"Hello world\");\r\n            });            \r\n        }\r\n    }\r\n\r\n    public class Program\r\n    {\r\n        public static void Main(string[] args)\r\n        {\r\n            CreateWebHostBuilder(args).Build().Run();\r\n        }\r\n\r\n        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;\r\n            WebHost.CreateDefaultBuilder(args)\r\n                .UseStartup&lt;Startup&gt;()\r\n                .UseEnvironment(\"Development\");\r\n    }\r\n}<\/pre>\n<p>\uacb0\uacfc : Hello world<\/p>\n","protected":false},"excerpt":{"rendered":"<p>using Microsoft.AspNetCore.Hosting; \/\/IWebHostBuilder using Microsoft.AspNetCore.Builder; \/\/IApplicationBuilder using Microsoft.AspNetCore.Http; \/\/WriteAsync using Microsoft.AspNetCore; \/\/webHost namespace WebApplication1 { public class Startup { public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime) { lifetime.ApplicationStarted.Register(() =&gt; System.Console.WriteLine(&#8220;===== Server is starting&#8221;)); lifetime.ApplicationStopping.Register(() =&gt; System.Console.WriteLine(&#8220;===== Server is stopping&#8221;)); lifetime.ApplicationStopped.Register(() =&gt; System.Console.WriteLine(&#8220;===== Server has stopped&#8221;)); app.Run(async context =&gt; { await context.Response.WriteAsync(&#8220;Hello world&#8221;); }); } } public\u2026 <span class=\"read-more\"><a href=\"https:\/\/csharp.ihavenomoney.co.kr\/?p=574\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[108],"tags":[],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-net-core"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=574"}],"version-history":[{"count":2,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions"}],"predecessor-version":[{"id":576,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions\/576"}],"wp:attachment":[{"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csharp.ihavenomoney.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}