{"id":319360,"date":"2021-03-11T03:00:25","date_gmt":"2021-03-11T03:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=319360"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=319360","title":{"rendered":"Blazor: Server \u0438 WebAssembly \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jl\/6t\/2b\/jl6t2bw0ol9-mhqdvhcu1xmyo0a.png\"><\/p>\n<p>  <\/p>\n<p>ASP.NET Core Blazor \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f Microsoft \u0432\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <em>\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/em> \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 WebAssembly (Blazor WebAssembly) \u0438\u043b\u0438 <em>\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/em> \u0432 ASP.NET Core (Blazor Server), \u043d\u043e \u0434\u0432\u0435 \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/github.com\/dotnet\/aspnetcore\/issues\/17678\" rel=\"nofollow noopener noreferrer\">\u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/aspnet\/core\/blazor\/hosting-models?view=aspnetcore-5.0\" rel=\"nofollow noopener noreferrer\">\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Server \u0438 WebAssembly \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438,<\/li>\n<li>\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0441 Server \u043d\u0430 WebAssembly \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f,<\/li>\n<li>\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438,<\/li>\n<li>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 Server \u0438 WebAssembly \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e gRPC.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>TL;DR:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/be\/bx\/zf\/bebxzf5o-oqhryu926nicakfyg0.gif\"><\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\" rel=\"nofollow noopener noreferrer\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 github.<\/a><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"vvedenie-zachem-eto-nuzhno\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435: \u0437\u0430\u0447\u0435\u043c \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u044e\u0442 \u0441\u0432\u043e\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438 \u0441\u0432\u043e\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438:<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 Blazor Server:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0451\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (blazor.server.js \u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044f ~ 250 \u041a\u0411).<\/li>\n<li>\u0411\u044b\u0441\u0442\u0440\u0430\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430.<\/li>\n<li>\u041e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u044b\u0439 UI.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Blazor Server:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0422\u0430\u043a \u043a\u0430\u043a \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f DOM \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0434\u043b\u044f \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0441\u0442\u0438 UI \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c.<\/li>\n<li>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/li>\n<li>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u043e.<\/li>\n<li>\u0421\u043b\u043e\u0436\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 Blazor WebAssembly<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u0442 \u0432\u0441\u0435\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432 Blazor Server, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0430\u0432\u0442\u043e\u043d\u043e\u043c\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c offline, \u0438\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c PWA.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 Blazor WebAssembly<\/p>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440: 10 \u2014 15 \u041c\u0431.<\/li>\n<li>\u0418\u0437-\u0437\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043e\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0434\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0439\u0442\u0438 15 \u2014 20 \u0441\u0435\u043a\u0443\u043d\u0434 (\u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430), \u0447\u0442\u043e \u0432 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0443\u0436\u0435 \u0437\u0430 \u0433\u0440\u0430\u043d\u044c\u044e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0433\u043e.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043e\u0431\u0435\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f, \u0438 \u0437\u0434\u043e\u0440\u043e\u0432\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0441\u0442\u044c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041d\u043e \u0434\u0430\u0436\u0435 \u0441\u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u043e\u043c \u0434\u043b\u044f WebAssembly \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u044b\u043c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u043b\u0433\u043e, \u0442\u0435 \u0436\u0435 15 \u2014 20 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 5 \u2014 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 Server \u0438 WebAssembly, \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u044b: \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 Server, \u0430 \u043f\u043e\u0437\u0436\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0440\u0435\u0436\u0438\u043c WebAssembly \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"chast-1-zapusk-server-i-webassembly-odnovremenno\">\u0427\u0430\u0441\u0442\u044c 1: \u0437\u0430\u043f\u0443\u0441\u043a Server \u0438 WebAssembly \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/h2>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u0441 <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/aspnet\/core\/blazor\/components\/prerendering-and-integration?view=aspnetcore-5.0&amp;pivots=webassembly\" rel=\"nofollow noopener noreferrer\">\u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f<\/a> WebAssembly \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 ASP.NET Core \u0438 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Prerendering.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a Blazor \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Server\/Pages\/_Host.cshtml\" rel=\"nofollow noopener noreferrer\"><code>_Host.cshtml<\/code><\/a> \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/aspnet\/core\/mvc\/views\/tag-helpers\/built-in\/component-tag-helper?view=aspnetcore-5.0\" rel=\"nofollow noopener noreferrer\">\u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 DOM<\/a> \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f Server \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;component type=&quot;typeof(App)&quot; render-mode=&quot;ServerPrerendered&quot; \/&gt; &lt;script src=&quot;_framework\/blazor.server.js&quot;&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u0434\u043b\u044f WebAssembly \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;component type=&quot;typeof(App)&quot; render-mode=&quot;WebAssemblyPrerendered&quot; \/&gt; &lt;script src=&quot;_framework\/blazor.webassembly.js&quot;&gt;&lt;\/script&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"xml\">&lt;srvr-app&gt;     &lt;component type=&quot;typeof(App)&quot; render-mode=&quot;ServerPrerendered&quot; \/&gt; &lt;\/srvr-app&gt; &lt;wasm-app style=&quot;display: none;&quot;&gt;     &lt;component type=&quot;typeof(App)&quot; render-mode=&quot;WebAssembly&quot;&gt; &lt;\/wasm-app&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u0442\u043e, \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u0433 <code>&lt;component&gt;<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u043a\u043e\u0439 html: <\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;!--Blazor:{ ... }&gt; ... &lt;--&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, blazor \u0438\u0449\u0435\u0442 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 DOM \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b <code>blazor.server.js<\/code> \u0438 <code>blazor.webassembly.js<\/code> \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u043e\u043d\u0438 \u043e\u0431\u0430 \u0431\u0443\u0434\u0443\u0442 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u0432\u0442\u043e\u0440\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0433\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a <code>blazor.webassembly.js<\/code> \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a <code>blazor.server.js<\/code> \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0440\u0430\u0431\u043e\u0442\u0443, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var loadWasmFunction = function () {      \/\/ \u0414\u043e\u0436\u0434\u0451\u043c\u0441\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 blazor.server.js \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443     if (srvrApp.innerHTML.indexOf('&lt;!--Blazor:{') !== -1) {         setTimeout(loadWasmFunction, 100);         return;     }      \/\/ \u0410 \u043f\u043e\u0442\u043e\u043c, \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c blazor.webassembly.js     loadScript('webassembly'); };  setTimeout(loadWasmFunction, 100);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (click, submit, onpush \u0438 \u0442.\u0434.) \u0443 <code>document<\/code> \u0438 <code>window<\/code>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e Server \u0438 WebAssembly \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0432\u043e\u0438\u0445 \u0443\u0437\u043b\u043e\u0432 <code>&lt;srvr-app&gt;<\/code> \u0438 <code>&lt;wasm-app&gt;<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c js best practices \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c <code>addEventListener<\/code> \u0434\u043b\u044f window \u0438 document:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">var addServerEvent = function (type, listener, options) {     srvrApp.addEventListener(type, listener, options); }  var addWasmEvent = function (type, listener, options) {     wasmApp.addEventListener(type, listener, options); }  \/\/ \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 blazor.server.js  window.addEventListener = addServerEvent; document.addEventListener = addServerEvent;  \/\/ ...  \/\/ \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 blazor.server.js,  \/\/ \u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 blazor.webassembly.js  window.addEventListener = addWasmEvent; document.addEventListener = addWasmEvent;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 WebAssembly \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e, \u0441\u043a\u0440\u044b\u0432 <code>&lt;srvr-app&gt;<\/code> \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0432 <code>&lt;wasm-app&gt;<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 Blazor Server \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c window.BlazorServer._internal.forceCloseConnection();  \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043c \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 wasmApp.style.display = &quot;block&quot;; srvrApp.style.display = &quot;none&quot;; \/\/ \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c Server, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0443\u0437\u0435\u043b<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u044d\u0442\u0443 \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Client\/wwwroot\/blazor.hybrid.js\" rel=\"nofollow noopener noreferrer\"><code>blazor.hybrid.js<\/code><\/a> \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0435\u0433\u043e \u043a <code>_Host.cshtml<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u0434\u0432\u0443\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0412 \u044d\u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0443 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0435\u0451 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0437 c# \u043a\u043e\u0434\u0430 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b c#-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Client\/Shared\/RuntimeHeader.razor\" rel=\"nofollow noopener noreferrer\"><code>RuntimeHeader.razor<\/code><\/a> \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private string Runtime =&gt; RuntimeInformation.RuntimeIdentifier;  protected override async Task OnAfterRenderAsync(bool firstRender) {     if (!firstRender) return;      if (Runtime == &quot;browser-wasm&quot;)     {         \/\/ \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 wasm-runtime,         \/\/ \u0437\u043d\u0430\u0447\u0438\u0442 WebAssembly - \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u043e\u0441\u044c           await JSRuntime.InvokeVoidAsync(&quot;wasmReady&quot;);     }      \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 WebAssembly \u043f\u0440\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438      EventHandler&lt;LocationChangedEventArgs&gt; switchFunc = null;     switchFunc = async (_, e) =&gt;     {         await JSRuntime.InvokeAsync&lt;bool&gt;(&quot;switchToWasm&quot;, e.Location);         NavManager.LocationChanged -= switchFunc;     };     NavManager.LocationChanged += switchFunc; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451, \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u0442\u0438\u043f \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 <code>appsettings.json<\/code><\/p>\n<p>  <\/p>\n<pre><code class=\"json\">&quot;HybridType&quot;: &quot;HybridOnNavigation&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0433\u0434\u0435 <code>HybridType<\/code> \u044d\u0442\u043e<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public enum HybridType {     \/\/ \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a Server     ServerSide,      \/\/ \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0430\u043a WebAssembly     WebAssembly,      \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 WebAssembly \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u044b\u0437\u043e\u0432\u043e\u043c switchToWasm     HybridManual,      \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 WebAssembly \u043f\u0440\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438     HybridOnNavigation,      \/\/ \u041f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 WebAssembly \u0441\u0440\u0430\u0437\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f     HybridOnReady }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"chast-2-autentifikaciya\">\u0427\u0430\u0441\u0442\u044c 2: \u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Server \u0438 WebAssembly \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u0441 \u043e\u0431\u0435\u0438\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0430\u044f \u0441\u0442\u043e\u0440\u043e\u043d\u0430 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u0430\u043c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 Cookie Authentication. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Server\/Startup.cs\" rel=\"nofollow noopener noreferrer\"><code>Startup.cs<\/code><\/a> \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Cookie Authentication <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/aspnet\/core\/security\/authentication\/?view=aspnetcore-5.0\" rel=\"nofollow noopener noreferrer\">\u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443: \u043a\u043e\u0433\u0434\u0430 Blazor Server \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u043a API \u043f\u043e HTTP, \u043e\u043d \u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HttpClient \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 (\u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c \u043a \u0441\u0435\u0431\u0435). \u0417\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c cookies \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 HttpClient. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Dependency Injection \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 HttpClient \u0434\u043b\u044f Blazor Server:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ \u0412 ConfigureServices \u0444\u0430\u0439\u043b\u0430 Startup.cs:  services.AddTransient(sp =&gt; {     var httpContextAccessor = sp.GetService&lt;IHttpContextAccessor&gt;();     var httpContext = httpContextAccessor.HttpContext;      \/\/ \u041f\u043e\u043b\u0443\u0447\u0438\u043c Cookies \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f      var cookies = httpContext.Request.Cookies;     var cookieContainer = new System.Net.CookieContainer();      \/\/ \u0418 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0438\u0445 \u0432 \u0435\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 HttpClientHandler      foreach (var c in cookies)     {         cookieContainer.Add(             new System.Net.Cookie(c.Key, c.Value)              {                  Domain = httpContext.Request.Host.Host              });     }      return new HttpClientHandler { CookieContainer = cookieContainer }; });  services.AddTransient(sp =&gt; {     var handler = sp.GetService&lt;HttpClientHandler&gt;();     return new HttpClient(handler); }); <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a API, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 Blazor Server \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u0430\u043c \u043a \u0441\u0435\u0431\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0432 Blazor Server \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a Set-Cookie, \u0432\u0435\u0434\u044c \u043e\u043d \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442 Cookie \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e HttpClient&#8217;\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0434\u043b\u044f Blazor Server \u0438 \u0434\u043b\u044f Blazor WebAssembly \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>IAuthService<\/code>, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c Blazor Server \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Cookie \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public interface IAuthService {     Task&lt;string&gt; Login(LoginRequest loginRequest, string returnUrl);     Task&lt;string&gt; Logout();      Task&lt;CurrentUser&gt; CurrentUserInfo(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f WebAssembly <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Client\/WasmAuthService.cs\" rel=\"nofollow noopener noreferrer\"><code>WasmAuthService.cs<\/code><\/a> \u0438 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Server\/Services\/ServerAuthService.cs\" rel=\"nofollow noopener noreferrer\"><code>ServerAuthService.cs<\/code><\/a> \u0434\u043b\u044f Server.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0441 Blazor Server \u0438 \u0441 Blazor WebAssembly.<\/p>\n<p>  <\/p>\n<h2 id=\"chast-3-sinhronizaciya-sostoyaniya-server-i-webassembly\">\u0427\u0430\u0441\u0442\u044c 3: \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f Server \u0438 WebAssembly<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u0415\u0441\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c Server \u043d\u0430 WebAssembly \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0435\u0451 \u043d\u0435 \u0440\u0435\u0448\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0443\u0442\u0435\u0439, \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Client\/Pages\/Counter.razor\" rel=\"nofollow noopener noreferrer\"><code>Counter.razor<\/code><\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e gRPC streaming.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c gRPC \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public interface ICounterService {     Task Increment();     Task Decrement();      IAsyncEnumerable&lt;CounterState&gt; SubscribeAsync(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Server\/Services\/CounterService.cs\" rel=\"nofollow noopener noreferrer\"><code>CounterService.cs<\/code><\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043a\u0430\u043a \u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0438\u043f\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 <code>Counter.razor<\/code> \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>ICounterService<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">[Inject] ICounterService CounterService { get; set; }  protected override void OnInitialized() {     var asyncState = CounterService.SubscribeAsync(); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043c\u0435\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>SubscribeAsync<\/code>:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/h8\/o5\/sc\/h8o5scfeb8_cw9ar9rpjcgagary.png\"><\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 <a href=\"https:\/\/github.com\/protobuf-net\/protobuf-net.Grpc\" rel=\"nofollow noopener noreferrer\">protobuf-net.Grpc<\/a>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c code-first \u043f\u043e\u0434\u0445\u043e\u0434 \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 gRPC-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0432\u043c\u0435\u0441\u0442\u043e \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f*.proto-\u0444\u0430\u0439\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c Dependency Injection \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 gRPC \u2014 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">services.AddTransient(sp =&gt; {     \/\/ Interceptor \u0443\u0434\u043e\u0431\u0435\u043d \u0434\u043b\u044f \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a     var interceptor = sp.GetService&lt;GrpcClientInterceptor&gt;();      \/\/ \u041d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439     var httpHandler = sp.GetService&lt;HttpClientHandler&gt;();      \/\/ \u041d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c URI \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f      var httpClient = sp.GetService&lt;HttpClient&gt;();      var handler = new Grpc.Net.Client.Web.GrpcWebHandler(         Grpc.Net.Client.Web.GrpcWebMode.GrpcWeb,         httpHandler ?? new HttpClientHandler());      var channel = Grpc.Net.Client.GrpcChannel.ForAddress(         httpClient.BaseAddress,         new Grpc.Net.Client.GrpcChannelOptions()         {             HttpHandler = handler         });      \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u043c \u0432\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b     var invoker = channel.Intercept(interceptor);      \/\/ \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e protobuf-net.Grpc     return GrpcClientFactory.CreateGrpcService&lt;T&gt;(invoker); });<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 DI \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441\u044b gRPC. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u0445 gRPC \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>[Authorize]<\/code>, \u043a\u0430\u043a \u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c ASP.NET Core \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435. \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\/blob\/main\/HybridBlazor\/Server\/Services\/WeatherForecastService.cs\" rel=\"nofollow noopener noreferrer\"><code>WeatherForecastService<\/code><\/a> \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u044d\u0442\u0438\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c.<\/p>\n<p>  <\/p>\n<h2 id=\"rezultat\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0435 ASP.NET Core Blazor \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 Kestrel, \u0432 IIS (IIS \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e HTTPS) \u0438 \u0432 Docker (\u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Kestrel).<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\" rel=\"nofollow noopener noreferrer\">\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 github.<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u044f \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u043e\u0431\u0440\u0430\u0437 \u0434\u043b\u044f docker:<\/p>\n<p>  <\/p>\n<pre><code class=\"powershell\">docker run --rm -p 80:80\/tcp jdtcn\/hybridblazorserver:latest<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0432 \u043b\u044e\u0431\u043e\u043c \u0438\u0437 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"powershell\">docker run --rm -p 80:80\/tcp jdtcn\/hybridblazorserver:latest -e HybridType=HybridManual<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043b\u044f \u0432\u0445\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u043e\u0433\u0438\u043d \u0438 \u043f\u0430\u0440\u043e\u043b\u044c demo.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Blazor \u0434\u0430\u0451\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u0451\u0442\u0430 \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0438 c#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u0443\u0439\u0442\u0435, \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435!<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/546414\/\"> https:\/\/habr.com\/ru\/post\/546414\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jl\/6t\/2b\/jl6t2bw0ol9-mhqdvhcu1xmyo0a.png\"><\/p>\n<p>  <\/p>\n<p>ASP.NET Core Blazor \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f Microsoft \u0432\u0435\u0431-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <em>\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430<\/em> \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 WebAssembly (Blazor WebAssembly) \u0438\u043b\u0438 <em>\u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/em> \u0432 ASP.NET Core (Blazor Server), \u043d\u043e \u0434\u0432\u0435 \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 <a href=\"https:\/\/github.com\/dotnet\/aspnetcore\/issues\/17678\" rel=\"nofollow noopener noreferrer\">\u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/aspnet\/core\/blazor\/hosting-models?view=aspnetcore-5.0\" rel=\"nofollow noopener noreferrer\">\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Server \u0438 WebAssembly \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438,<\/li>\n<li>\u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0441 Server \u043d\u0430 WebAssembly \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f,<\/li>\n<li>\u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438,<\/li>\n<li>\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 Server \u0438 WebAssembly \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e gRPC.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>TL;DR:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Gif \u0441 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/be\/bx\/zf\/bebxzf5o-oqhryu926nicakfyg0.gif\"><\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/jdtcn\/HybridBlazor\" rel=\"nofollow noopener noreferrer\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u043d\u0430 github.<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-319360","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=319360"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319360\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}