{"id":1008,"date":"2025-02-14T02:59:19","date_gmt":"2025-02-14T10:59:19","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/?p=1008"},"modified":"2025-02-14T02:59:19","modified_gmt":"2025-02-14T10:59:19","slug":"net-9-%e7%bd%91%e7%bb%9c%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/net-9-%e7%bd%91%e7%bb%9c%e4%bc%98%e5%8c%96\/","title":{"rendered":".NET 9 \u7f51\u7edc\u4f18\u5316"},"content":{"rendered":"<p style=\"text-align: center;\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><em><span style=\"font-size: 12pt;\">\u672c\u6587\u7ffb\u8bd1\u81ea <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/mapichov\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"M\u00e1\u0148a\">M\u00e1\u0148a<\/a>, <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/knatalia\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Natalia\">Natalia<\/a> \u548c <a class=\"read-more\" href=\"https:\/\/devblogs.microsoft.com\/dotnet\/author\/anfirszo\" data-bi-area=\"body_author_top\" data-bi-id=\"post_page_body_author_top_name\" data-bi-name=\"Anton\">Anton<\/a> \u521b\u4f5c\u7684 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/\">.NET 9 Networking Improvements<\/a><\/span><\/em><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u79c9\u627f\u6211\u4eec\u7684\u4f20\u7edf\uff0c\u6211\u4eec\u5f88\u9ad8\u5174\u4e0e\u60a8\u5206\u4eab\u8fd9\u7bc7\u535a\u5ba2\u6587\u7ae0\uff0c\u4ee5\u4ecb\u7ecd\u65b0\u7684 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-9\/\">.NET \u7248\u672c<\/a>\u4e2d\u7f51\u7edc\u9886\u57df\u76f8\u5173\u7684\u6700\u65b0\u52a8\u6001\u548c\u6700\u6709\u8da3\u7684\u53d8\u5316\u3002\u4eca\u5e74\uff0c\u6211\u4eec\u5e26\u6765\u4e86 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#http\">HTTP<\/a> \u9886\u57df\u7684\u6539\u53d8\u3001\u65b0\u7684 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#httpclientfactory\">HttpClientFactory<\/a> API\u3001<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#net-framework-compatibility\">.NET Framework \u517c\u5bb9\u6027<\/a>\u4f18\u5316\u7b49\u66f4\u591a\u5185\u5bb9\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>HTTP<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u63a5\u4e0b\u6765\u7684\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd HTTP \u9886\u57df\u6700\u5177\u5f71\u54cd\u529b\u7684\u53d8\u5316\u3002\u5176\u4e2d\u5305\u62ec\u8fde\u63a5\u6c60\u7684\u6027\u80fd\u4f18\u5316\u3001\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u652f\u6301\u3001Windows\u4ee3\u7406\u7684\u81ea\u52a8\u66f4\u65b0\uff0c\u4ee5\u53ca\u91cd\u8981\u7684\u793e\u533a\u8d21\u732e\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u8fde\u63a5\u6c60<\/b><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u6b64\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u5bf9HTTP\u8fde\u63a5\u6c60\u8fdb\u884c\u4e86\u4e24\u9879\u663e\u8457\u7684\u6027\u80fd\u4f18\u5316\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u589e\u52a0\u4e86\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u53ef\u9009\u652f\u6301\u3002\u6839\u636e<a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc9114#section-3.3\">RFC 9114\u6807\u51c6\u6587\u6863<\/a>\uff0c\u7531\u4e8e\u8fde\u63a5\u53ef\u4ee5\u591a\u8def\u590d\u7528\u5e76\u884c\u8bf7\u6c42\uff0c\u56e0\u6b64\u4e0d\u9f13\u52b1\u4f7f\u7528\u591a\u4e2aHTTP\/3\u8fde\u63a5\u5230\u5bf9\u7b49\u7aef\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u4f8b\u5982\u670d\u52a1\u5668\u5230\u670d\u52a1\u5668\u7684\u901a\u4fe1\uff0c\u5373\u4f7f\u8bf7\u6c42\u591a\u8def\u590d\u7528\uff0c\u5355\u4e00\u8fde\u63a5\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u6211\u4eec\u5728 HTTP\/2 \u4e2d\u770b\u5230\u4e86\u8fd9\u6837\u7684\u9650\u5236\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/35088\">dotnet\/runtime#35088<\/a>\uff09\uff0c\u5b83\u540c\u6837\u5177\u6709\u5728\u5355\u4e00\u8fde\u63a5\u4e0a\u591a\u8def\u590d\u7528\u7684\u6982\u5ff5\u3002\u51fa\u4e8e\u540c\u6837\u7684\u539f\u56e0\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/51775\">dotnet\/runtime#51775<\/a>\uff09\uff0c\u6211\u4eec\u51b3\u5b9a\u4e3aHTTP\/3\u5b9e\u73b0\u591a\u8fde\u63a5\u652f\u6301\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/101535\">dotnet\/runtime#101535<\/a>\uff09\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8be5\u5b9e\u73b0\u672c\u8eab\u5c3d\u53ef\u80fd\u8d34\u8fd1 HTTP\/2 \u591a\u8fde\u63a5\u673a\u5236\u7684\u884c\u4e3a\u3002\u5f53\u524d\uff0c\u5b83\u7684\u7b56\u7565\u662f\u4f18\u5148\u586b\u5145\u5df2\u6709\u8fde\u63a5\uff0c\u76f4\u5230\u8fbe\u5230\u5bf9\u7aef\u5141\u8bb8\u7684\u8bf7\u6c42\u4e0a\u9650\u540e\uff0c\u624d\u4f1a\u521b\u5efa\u65b0\u7684\u8fde\u63a5\u3002\u4e0d\u8fc7\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u8be5\u884c\u4e3a\u5728\u672a\u6765\u53ef\u80fd\u4f1a\u6709\u6240\u53d8\u5316\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7ed3\u679c\u662f\uff0c\u6211\u4eec\u7684\u57fa\u51c6\u6d4b\u8bd5\u663e\u793a\u6bcf\u79d2\u8bf7\u6c42\u6570\uff08RPS\uff09\u6709\u663e\u8457\u63d0\u5347\uff0c\u4ee5\u4e0b\u662f10,000\u4e2a\u5e76\u884c\u8bf7\u6c42\u7684\u5bf9\u6bd4\u7ed3\u679c\uff1a\u00a0<\/span><\/p>\n<table data-tablestyle=\"MsoTableGrid\" data-tablelook=\"1696\" aria-rowcount=\"9\">\n<tbody>\n<tr aria-rowindex=\"1\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5ba2\u6237\u7aef\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5355 HTTP\/3 \u8fde\u63a5\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u591a HTTP\/3 \u8fde\u63a5\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"2\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u5927CPU\u4f7f\u7528\u7387(%)\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">35\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">92\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"3\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u5927\u6838\u5fc3\u4f7f\u7528\u7387(%)\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">971\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">2572\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"4\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u5927\u5de5\u4f5c\u96c6(MB)\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">3810\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">6491\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"5\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u5927\u79c1\u6709\u5185\u5b58(MB)\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">4415\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">7228\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"6\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5904\u7406\u5668\u6570\u91cf\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">28\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">28\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"7\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9996\u6b21\u8bf7\u6c42\u65f6\u957f(ms)\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">519\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">594\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"8\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8bf7\u6c42\u6570\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">345446\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">4325325\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"9\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5e73\u5747\u6bcf\u79d2\u54cd\u5e94\u6570\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">23069\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">288664\u00a0<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8bf7\u6ce8\u610f\uff0c\u6700\u5927 CPU \u4f7f\u7528\u7387\u7684\u589e\u52a0\u610f\u5473\u7740 CPU \u5229\u7528\u7387\u66f4\u9ad8\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0cCPU \u6b63\u5728\u5fd9\u4e8e\u5904\u7406\u8bf7\u6c42\uff0c\u800c\u4e0d\u662f\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u53ef\u4ee5\u901a\u8fc7 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.socketshttphandler.enablemultiplehttp3connections\">SocketsHttpHandler<\/a> \u4e0a\u7684 <code>EnableMultipleHttp3Connections<\/code> \u5c5e\u6027\u6765\u542f\u7528\u6b64\u529f\u80fd\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">var client = new HttpClient(new SocketsHttpHandler\r\n{\r\n    EnableMultipleHttp3Connections = true\r\n});<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u8fd8\u89e3\u51b3\u4e86 HTTP\/1.1 \u8fde\u63a5\u6c60\u4e2d\u7684\u9501\u4e89\u7528\u95ee\u9898\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/70098\">dotnet\/runtime#70098<\/a>\uff09\u3002 \u6b64\u524d\uff0cHTTP\/1.1 \u8fde\u63a5\u6c60\u4f7f\u7528\u5355\u4e00\u9501\u6765\u7ba1\u7406\u8fde\u63a5\u5217\u8868\u548c\u5f85\u5904\u7406\u8bf7\u6c42\u961f\u5217\u3002\u5728\u9ad8\u541e\u5410\u91cf\u573a\u666f\u4e0b\uff0c\u7279\u522b\u662f\u5728\u62e5\u6709\u5927\u91cf CPU \u6838\u5fc3\u7684\u673a\u5668\u4e0a\uff0c\u8fd9\u4e2a\u9501\u6210\u4e3a\u4e86\u6027\u80fd\u74f6\u9888\u3002 \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/99364\">dotnet\/runtime#99364<\/a>\uff09\uff0c\u6211\u4eec\u7528\u5e76\u53d1\u96c6\u5408\uff08Concurrent Collection\uff09\u66ff\u6362\u4e86\u539f\u672c\u5e26\u9501\u7684\u666e\u901a\u5217\u8868\u3002\u6211\u4eec\u9009\u62e9\u4e86 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.collections.concurrent.concurrentstack-1\">ConcurrentStack<\/a>\uff0c\u56e0\u4e3a\u5b83\u5728\u8bf7\u6c42\u7531\u6700\u65b0\u7684\u53ef\u7528\u8fde\u63a5\u5904\u7406\u65f6\u4fdd\u7559\u53ef\u89c2\u5bdf\u7684\u884c\u4e3a\uff0c\u8fd9\u5141\u8bb8\u5728\u8fde\u63a5\u7684<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.socketshttphandler.pooledconnectionlifetime\">\u751f\u547d\u5468\u671f<\/a>\u5230\u671f\u540e\u56de\u6536\u65e7\u8fde\u63a5\u3002 \u5728\u6211\u4eec\u7684\u57fa\u51c6\u6d4b\u8bd5\u4e2d\uff0c\u8fd9\u4e00\u4f18\u5316\u4f7f HTTP\/1.1 \u8bf7\u6c42\u7684\u541e\u5410\u91cf\u63d0\u9ad8\u4e8630%\u4ee5\u4e0a\u3002\u00a0<\/span><\/p>\n<table data-tablestyle=\"MsoTableGrid\" data-tablelook=\"1696\" aria-rowcount=\"3\">\n<tbody>\n<tr aria-rowindex=\"1\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5ba2\u6237\u7aef\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 8.0\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 9.0\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u589e\u957f\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"2\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8bf7\u6c42\u6570\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">80028791\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">107128778\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">+33.86%\u00a0<\/span><\/td>\n<\/tr>\n<tr aria-rowindex=\"3\">\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5e73\u5747\u6bcf\u79d2\u54cd\u5e94\u6570\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">666886\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">892749\u00a0<\/span><\/td>\n<td data-celllook=\"0\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">+33.87%\u00a0<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>Windows \u4e0a\u7684\u4ee3\u7406\u81ea\u52a8\u66f4\u65b0<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u5f00\u53d1\u8005\u4f7f\u7528\u65e9\u671f\u7248\u672c .NET \u7684\u5e94\u7528\u7a0b\u5e8f\u8fdb\u884c HTTP \u6d41\u91cf\u8c03\u8bd5\u65f6\uff0c\u4ed6\u4eec\u7684\u4e3b\u8981\u75db\u70b9\u4e4b\u4e00\u662f\u5e94\u7528\u7a0b\u5e8f\u4e0d\u4f1a\u54cd\u5e94 Windows \u4ee3\u7406\u8bbe\u7f6e\u7684\u66f4\u6539\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/46910\">dotnet\/runtime#70098<\/a>\uff09\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6b64\u524d\uff0c\u4ee3\u7406\u8bbe\u7f6e\u5728\u6bcf\u4e2a\u8fdb\u7a0b\u542f\u52a8\u65f6\u4ec5\u521d\u59cb\u5316\u4e00\u6b21\uff0c\u6ca1\u6709\u5408\u7406\u7684\u65b9\u5f0f\u6765\u5237\u65b0\u8fd9\u4e9b\u8bbe\u7f6e \u3002\u4f8b\u5982\uff0c\u5728 .NET 8 \u4e2d\uff0c<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.httpclient.defaultproxy\">HttpClient.DefaultProxy<\/a> \u6bcf\u6b21\u8bbf\u95ee\u90fd\u4f1a\u8fd4\u56de\u76f8\u540c\u7684\u5b9e\u4f8b\uff0c\u4e14\u4e0d\u4f1a\u91cd\u65b0\u83b7\u53d6\u4ee3\u7406\u8bbe\u7f6e\u3002\u56e0\u6b64\uff0c\u50cf Fiddler \u8fd9\u6837\u5c06\u81ea\u5df1\u8bbe\u7f6e\u4e3a\u7cfb\u7edf\u4ee3\u7406\u4ee5\u76d1\u542c\u6d41\u91cf\u7684\u5de5\u5177\uff0c\u65e0\u6cd5\u6355\u83b7\u5df2\u7ecf\u8fd0\u884c\u8fdb\u7a0b\u7684\u6d41\u91cf\u3002\u8fd9\u4e2a\u95ee\u9898\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/103364\">dotnet\/runtime#103364<\/a> \u4e2d\u5f97\u5230\u4e86\u7f13\u89e3\uff0c\u5176\u4e2d <code>HttpClient.DefaultProxy<\/code> \u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2aWindows\u4ee3\u7406\u5b9e\u4f8b\uff0c\u8be5\u5b9e\u4f8b\u4f1a\u76d1\u542c\u6ce8\u518c\u8868\u7684\u53d8\u5316\uff0c\u5e76\u5728\u6536\u5230\u901a\u77e5\u65f6\u91cd\u65b0\u52a0\u8f7d\u4ee3\u7406\u8bbe\u7f6e\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">while (true)\r\n{\r\n    using var resp = await client.GetAsync(\"https:\/\/httpbin.org\/\");\r\n    Console.WriteLine(HttpClient.DefaultProxy.GetProxy(new Uri(\"https:\/\/httpbin.org\/\"))?.ToString() ?? \"null\");\r\n    await Task.Delay(1_000);\r\n}<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u53ef\u4ee5\u4ea7\u751f\u5982\u4e0b\u8f93\u51fa\uff1a<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">null\r\n\/\/ After Fiddler's \"System Proxy\" is turned on.\r\nhttp:\/\/127.0.0.1:8866\/<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u66f4\u6539\u4ec5\u9002\u7528\u4e8e Windows\uff0c\u56e0\u4e3a\u5b83\u5177\u6709\u7edf\u4e00\u7684<a href=\"https:\/\/support.microsoft.com\/windows\/use-a-proxy-server-in-windows-03096c53-0554-4ffe-b6ab-8b1deee8dae1\">\u5168\u5c40\u7cfb\u7edf\u4ee3\u7406\u8bbe\u7f6e<\/a>\u6982\u5ff5\u3002\u800c Linux \u53ca\u5176\u4ed6\u57fa\u4e8e UNIX \u7684\u7cfb\u7edf\u4ec5\u5141\u8bb8\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u4ee3\u7406\uff0c\u8fd9\u4e9b\u73af\u5883\u53d8\u91cf\u5728\u8fdb\u7a0b\u8fd0\u884c\u671f\u95f4\u65e0\u6cd5\u66f4\u6539\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u793e\u533a\u8d21\u732e<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u60f3\u611f\u8c22\u793e\u533a\u505a\u51fa\u7684\u8d21\u732e\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.httpcontent.loadintobufferasync\">HttpContent.LoadIntoBufferAsync<\/a> \u4e2d\u7f3a\u5c11 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.threading.cancellationtoken\">CancellationToken<\/a> \u91cd\u8f7d\u3002<a href=\"https:\/\/github.com\/andrewhickman-aveva\">@andrewhickman-aveva<\/a> \u7684 API \u63d0\u6848 (<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/102659\">dotnet\/runtime#102659<\/a>) \u548c <a href=\"https:\/\/github.com\/manandre\">@manandre<\/a> \u7684\u5b9e\u73b0 (<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/103991\">dotnet\/runtime#103991<\/a>) \u89e3\u51b3\u4e86\u6b64\u95ee\u9898\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u53e6\u4e00\u4e2a\u66f4\u6539\u4f18\u5316\u4e86 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.socketshttphandler\">SocketsHttpHandler<\/a> \u548c <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.httpclienthandler\">HttpClientHandler<\/a> \u4e0a\u7684 <code>MaxResponseHeadersLength<\/code> \u5c5e\u6027\u7684\u5355\u4f4d\u4e0d\u4e00\u81f4\u95ee\u9898\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/75137\">dotnet\/runtime#75137<\/a>\uff09\u3002\u6240\u6709\u5176\u4ed6\u7684\u5927\u5c0f\u548c\u957f\u5ea6\u5c5e\u6027\u90fd\u88ab\u89e3\u91ca\u4e3a\u5b57\u8282\uff0c\u800c\u8fd9\u4e2a\u5c5e\u6027\u5374\u88ab\u89e3\u91ca\u4e3a\u5343\u5b57\u8282\u3002\u7531\u4e8e\u4e0d\u80fd\u6539\u53d8\u5b9e\u9645\u884c\u4e3a\u4ee5\u4fdd\u6301\u5411\u540e\u517c\u5bb9\u6027\uff0c\u56e0\u6b64\u901a\u8fc7\u5b9e\u73b0\u4e00\u4e2a\u5206\u6790\u5668\uff08<a href=\"https:\/\/github.com\/dotnet\/roslyn-analyzers\/pull\/6796\">dotnet\/roslyn-analyzers#6796<\/a>\uff09\u6765\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002\u8be5\u5206\u6790\u5668\u65e8\u5728\u786e\u4fdd\u7528\u6237\u610f\u8bc6\u5230\u63d0\u4f9b\u7684\u503c\u662f\u4ee5\u5343\u5b57\u8282\u4e3a\u5355\u4f4d\u7684\uff0c\u5e76\u4e14\u5982\u679c\u7528\u6cd5\u8868\u660e\u6709\u8bef\uff0c\u5219\u4f1a\u53d1\u51fa\u8b66\u544a\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5982\u679c\u8be5\u503c\u9ad8\u4e8e\u67d0\u4e2a\u9608\u503c\uff0c\u5219\u5982\u4e0b\u6240\u793a\uff1a\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning.png\"><img decoding=\"async\" class=\"alignnone wp-image-1015\" src=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning-300x44.png\" alt=\"Image analyzer warning\" width=\"764\" height=\"112\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning-300x44.png 300w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning-1024x149.png 1024w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning-768x112.png 768w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/analyzer_warning.png 1265w\" sizes=\"(max-width: 764px) 100vw, 764px\" \/><\/a><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8be5\u5206\u6790\u5668\u7531 <a href=\"https:\/\/github.com\/amiru3f\">@amiru3f<\/a> \u5b9e\u73b0\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>QUIC<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 9 \u4e2d\uff0cQUIC \u9886\u57df\u7684\u663e\u8457\u53d8\u5316\u5305\u62ec\u5c06 QUIC \u5e93\u516c\u5f00\u3001\u4e3a\u8fde\u63a5\u63d0\u4f9b\u66f4\u591a\u914d\u7f6e\u9009\u9879\u4ee5\u53ca\u591a\u9879\u6027\u80fd\u4f18\u5316\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u516c\u5171API<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece\u6b64\u7248\u672c\u5f00\u59cb\uff0c<code>System.Net.Quic<\/code> \u4e0d\u518d\u9690\u85cf\u5728 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/apicompat\/preview-apis#requirespreviewfeaturesattribute\">PreviewFeature<\/a> \u540e\u9762\uff0c\u6240\u6709\u7684 API \u90fd\u662f\u968f\u65f6\u53ef\u7528\u7684\uff0c\u65e0\u9700\u6dfb\u52a0\u4efb\u4f55\u53ef\u9009\u5f00\u5173\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/104227\">dotnet\/runtime#104227<\/a>\uff09\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><strong>QUIC\u8fde\u63a5\u9009\u9879\u00a0<\/strong><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u6269\u5c55\u4e86 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnection\">QuicConnection<\/a> \u7684\u914d\u7f6e\u9009\u9879\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/72984\">dotnet\/runtime#72984<\/a>\uff09\u3002\u8be5\u5b9e\u73b0\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/94211\">dotnet\/runtime#94211<\/a>\uff09\u5411 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions\">QuicConnectionOptions<\/a> \u4e2d\u6dfb\u52a0\u4e86\u4e09\u4e2a\u65b0\u5c5e\u6027\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions.handshaketimeout\">HandshakeTimeout<\/a> \u2013 \u6211\u4eec\u4e4b\u524d\u5df2\u7ecf\u5bf9\u8fde\u63a5\u5efa\u7acb\u7684\u6700\u5927\u65f6\u957f\u8fdb\u884c\u4e86\u9650\u5236\uff0c\u8fd9\u4e2a\u5c5e\u6027\u5141\u8bb8\u7528\u6237\u8c03\u6574\u8be5\u9650\u5236\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions.keepaliveinterval\">KeepAliveInterval<\/a> \u2013 \u5982\u679c\u8be5\u5c5e\u6027\u8bbe\u7f6e\u4e3a\u6b63\u503c\uff0c\u5219\u5728\u6b64\u65f6\u95f4\u95f4\u9694\u5185\u5b9a\u671f\u53d1\u9001 <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9000#name-ping-frames\">PING \u5e27<\/a>\uff08\u5982\u679c\u8fde\u63a5\u4e0a\u6ca1\u6709\u5176\u4ed6\u6d3b\u52a8\uff09\uff0c\u4ee5\u9632\u6b62\u8fde\u63a5\u56e0<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9000#name-idle-timeout\">\u7a7a\u95f2\u8d85\u65f6<\/a>\u800c\u88ab\u5173\u95ed\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions.initialreceivewindowsizes\">InitialReceiveWindowSizes<\/a> \u2013 \u4e00\u7ec4\u53c2\u6570\uff0c\u7528\u4e8e\u8c03\u6574<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9000#transport-parameter-definitions\">\u4f20\u8f93\u53c2\u6570<\/a>\u4e2d\u6570\u636e\u6d41\u63a7\u5236\u7684\u521d\u59cb\u63a5\u6536\u9650\u5236\u3002\u8fd9\u4e9b\u6570\u636e\u9650\u5236\u4ec5\u9002\u7528\u4e8e\u52a8\u6001\u6d41\u91cf\u63a7\u5236\u7b97\u6cd5\u5f00\u59cb\u6839\u636e\u6570\u636e\u8bfb\u53d6\u901f\u5ea6\u8c03\u6574\u9650\u5236\u4e4b\u524d\u3002\u7531\u4e8e <a href=\"https:\/\/github.com\/microsoft\/msquic\/blob\/main\/docs\/api\/QUIC_SETTINGS.md\">MsQuic<\/a> \u7684\u9650\u5236\uff0c\u8fd9\u4e9b\u53c2\u6570\u53ea\u80fd\u8bbe\u7f6e\u4e3a 2 \u7684\u5e42\u6b21\u65b9\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6240\u6709\u8fd9\u4e9b\u53c2\u6570\u90fd\u662f\u53ef\u9009\u7684\u3002\u5b83\u4eec\u7684\u9ed8\u8ba4\u503c\u6e90\u81ea <a href=\"https:\/\/github.com\/microsoft\/msquic\/blob\/main\/docs\/Settings.md\">MsQuic\u7684\u9ed8\u8ba4\u503c<\/a>\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u901a\u8fc7\u7f16\u7a0b\u65b9\u5f0f\u62a5\u544a\u9ed8\u8ba4\u503c\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">var options = new QuicClientConnectionOptions();\r\nConsole.WriteLine($\"KeepAliveInterval = {PrettyPrintTimeStamp(options.KeepAliveInterval)}\");\r\nConsole.WriteLine($\"HandshakeTimeout = {PrettyPrintTimeStamp(options.HandshakeTimeout)}\");\r\nConsole.WriteLine(@$\"InitialReceiveWindowSizes =\r\n{{\r\n    Connection = {PrettyPrintInt(options.InitialReceiveWindowSizes.Connection)},\r\n    LocallyInitiatedBidirectionalStream = {PrettyPrintInt(options.InitialReceiveWindowSizes.LocallyInitiatedBidirectionalStream)},\r\n    RemotelyInitiatedBidirectionalStream = {PrettyPrintInt(options.InitialReceiveWindowSizes.RemotelyInitiatedBidirectionalStream)},\r\n    UnidirectionalStream = {PrettyPrintInt(options.InitialReceiveWindowSizes.UnidirectionalStream)}\r\n}}\");\r\n\r\nstatic string PrettyPrintTimeStamp(TimeSpan timeSpan)\r\n    =&gt; timeSpan == Timeout.InfiniteTimeSpan ? \"infinite\" : timeSpan.ToString();\r\n\r\nstatic string PrettyPrintInt(int sizeB)\r\n    =&gt; sizeB % 1024 == 0 ? $\"{sizeB \/ 1024} * 1024\" : sizeB.ToString();\r\n\r\n\/\/ Prints:\r\nKeepAliveInterval = infinite\r\nHandshakeTimeout = 00:00:10\r\nInitialReceiveWindowSizes =\r\n{\r\n    Connection = 16384 * 1024,\r\n    LocallyInitiatedBidirectionalStream = 64 * 1024,\r\n    RemotelyInitiatedBidirectionalStream = 64 * 1024,\r\n    UnidirectionalStream = 64 * 1024\r\n}<\/code><\/span><\/pre>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><span style=\"font-size: 18pt;\"><b>\u6d41\u5bb9\u91cf API<\/b><\/span>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 9 \u8fd8\u5f15\u5165\u4e86\u65b0\u7684 API \u4ee5\u652f\u6301\u5728 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.socketshttphandler.enablemultiplehttp3connections\">SocketsHttpHandler<\/a> \u4e2d\u4f7f\u7528<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#connection-pooling\">\u591a\u4e2a HTTP\/3 \u8fde\u63a5<\/a>\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/101534\">dotnet\/runtime#101534<\/a>\uff09\u3002\u8fd9\u4e9b API \u662f\u4e13\u95e8\u4e3a\u8fd9\u79cd\u7279\u5b9a\u7528\u6cd5\u8bbe\u8ba1\u7684\uff0c\u6211\u4eec\u9884\u8ba1\u9664\u4e86\u975e\u5e38\u5c0f\u4f17\u7684\u5e94\u7528\u573a\u666f\u5916\u8fd9\u4e9b API\u53ef\u80fd\u4e0d\u4f1a\u88ab\u9891\u7e41\u4f7f\u7528 \u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">QUIC \u534f\u8bae\u5185\u7f6e\u4e86<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9000#name-max_streams-frames\">\u6d41\u91cf\u9650\u5236<\/a>\u7ba1\u7406\u903b\u8f91\u3002\u56e0\u6b64\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u7528\u7684\u6d41\u5bb9\u91cf\uff0c\u8c03\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnection.openoutboundstreamasync\">OpenOutboundStreamAsync<\/a> \u6765\u521b\u5efa\u65b0\u6d41\u4f1a\u88ab\u6682\u505c\u3002\u6b64\u5916\uff0c\u76ee\u524d\u6ca1\u6709\u6709\u6548\u7684\u65b9\u6cd5\u6765\u5224\u65ad\u6d41\u9650\u5236\u662f\u5426\u5df2\u8fbe\u5230\u3002\u6240\u6709\u8fd9\u4e9b\u9650\u5236\u4f7f\u5f97 HTTP\/3 \u5c42\u65e0\u6cd5\u5224\u65ad\u4f55\u65f6\u5e94\u6253\u5f00\u65b0\u7684\u8fde\u63a5\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u5f15\u5165\u4e86\u4e00\u4e2a\u65b0\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions.streamcapacitycallback\">StreamCapacityCallback<\/a>\uff0c\u6bcf\u5f53\u6d41\u5bb9\u91cf\u589e\u52a0\u65f6\u90fd\u4f1a\u8c03\u7528\u8be5\u56de\u8c03\u3002\u8be5\u56de\u8c03\u672c\u8eab\u901a\u8fc7 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions\">QuicConnectionOptions<\/a> \u6ce8\u518c\u3002\u6709\u5173\u56de\u8c03\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/quic\/quic-options#streamcapacitycallback\">\u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u6027\u80fd\u4f18\u5316<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>System.Net.Quic<\/code> \u4e2d\u7684\u4e24\u9879\u6027\u80fd\u4f18\u5316\u90fd\u4e0e TLS \u76f8\u5173\uff0c\u5e76\u4e14\u90fd\u53ea\u5f71\u54cd\u8fde\u63a5\u5efa\u7acb\u7684\u65f6\u95f4\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7b2c\u4e00\u9879\u4e0e\u6027\u80fd\u76f8\u5173\u7684\u66f4\u6539\u662f\u5728 .NET \u7ebf\u7a0b\u6c60\u4e2d\u5f02\u6b65\u8fd0\u884c\u5bf9\u7b49\u8bc1\u4e66\u9a8c\u8bc1 (<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/98361\">dotnet\/runtime#98361<\/a>)\u3002\u8bc1\u4e66\u9a8c\u8bc1\u672c\u8eab\u53ef\u80fd\u975e\u5e38\u8017\u65f6\uff0c\u751a\u81f3\u53ef\u80fd\u5305\u62ec\u6267\u884c\u7528\u6237\u56de\u8c03\u3002\u5c06\u6b64\u903b\u8f91\u79fb\u52a8\u5230 .NET \u7ebf\u7a0b\u6c60\u53ef\u9632\u6b62\u6211\u4eec\u963b\u585e MsQuic \u7ebf\u7a0b\uff08MsQuic \u7684\u7ebf\u7a0b\u6570\u91cf\u6709\u9650\uff09\uff0c\u4ece\u800c\u4f7f MsQuic \u80fd\u591f\u540c\u65f6\u5904\u7406\u66f4\u591a\u65b0\u8fde\u63a5\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u66f4\u91cd\u8981\u7684\u662f\uff0c\u6211\u4eec\u8fd8\u5f15\u5165\u4e86 MsQuic \u914d\u7f6e\u7684\u7f13\u5b58\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/99371\">dotnet\/runtime#99371<\/a>\uff09\u3002MsQuic \u914d\u7f6e\u662f\u4e00\u7ec4\u672c\u5730\u7ed3\u6784\uff0c\u5305\u542b\u6765\u81ea <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnectionoptions\">QuicConnectionOptions<\/a> \u7684\u8fde\u63a5\u8bbe\u7f6e\uff0c\u53ef\u80fd\u5305\u62ec\u8bc1\u4e66\u53ca\u5176\u4e2d\u4ecb\u8bc1\u4e66\u3002\u6784\u5efa\u548c\u521d\u59cb\u5316\u8fd9\u4e9b\u672c\u5730\u7ed3\u6784\u53ef\u80fd\u975e\u5e38\u6602\u8d35\uff0c\u56e0\u4e3a\u8fd9\u53ef\u80fd\u9700\u8981\u5c06\u6240\u6709\u8bc1\u4e66\u6570\u636e\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u4e3a <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc7292\">PKS #12<\/a> \u683c\u5f0f\u3002\u6b64\u5916\uff0c\u8be5\u7f13\u5b58\u5141\u8bb8\u5728\u8bbe\u7f6e\u76f8\u540c\u7684\u60c5\u51b5\u4e0b\uff0c\u91cd\u7528\u76f8\u540c\u7684 MsQuic \u914d\u7f6e\u6765\u5904\u7406\u4e0d\u540c\u7684\u8fde\u63a5\u3002\u7279\u522b\u662f\u670d\u52a1\u5668\u573a\u666f\uff0c\u5177\u6709\u9759\u6001\u914d\u7f6e\u7684\u573a\u666f\u53ef\u4ee5\u4ece\u7f13\u5b58\u4e2d\u83b7\u76ca\uff0c\u4ee5\u4e0b\u662f\u76f8\u5173\u4ee3\u7801\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">var alpn = \"test\";\r\nvar serverCertificate = X509CertificateLoader.LoadCertificateFromFile(\"..\/path\/to\/cert\");\r\n\r\n\/\/ Prepare the connection option upfront and reuse them.\r\nvar serverConnectionOptions = new QuicServerConnectionOptions()\r\n{\r\n    DefaultStreamErrorCode = 123,\r\n    DefaultCloseErrorCode = 456,\r\n    ServerAuthenticationOptions = new SslServerAuthenticationOptions\r\n    {\r\n        ApplicationProtocols = new List&lt;SslApplicationProtocol&gt;() { alpn },\r\n        \/\/ Re-using the same certificate.\r\n        ServerCertificate = serverCertificate\r\n    }\r\n};\r\n\r\n\/\/ Configure the listener to return the pre-prepared options.\r\nawait using var listener = await QuicListener.ListenAsync(new QuicListenerOptions()\r\n{\r\n    ListenEndPoint = new IPEndPoint(IPAddress.Loopback, 0),\r\n    ApplicationProtocols = [ alpn ],\r\n    \/\/ Callback returns the same object.\r\n    \/\/ Internal cache will re-use the same native structure for every incoming connection.\r\n    ConnectionOptionsCallback = (_, _, _) =&gt; ValueTask.FromResult(serverConnectionOptions)\r\n});<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u8fd8\u4e3a\u6b64\u529f\u80fd\u6784\u5efa\u4e86\u4e00\u4e2a\u5907\u7528\u65b9\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7\u4efb\u4e00\u73af\u5883\u53d8\u91cf\u5173\u95ed\u8be5\u529f\u80fd\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">export DOTNET_SYSTEM_NET_QUIC_DISABLE_CONFIGURATION_CACHE=1\r\n# run the app<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6216\u8005\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.appcontext\">AppContext<\/a> \u5f00\u5173\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">AppContext.SetSwitch(\"System.Net.Quic.DisableConfigurationCache\", true);<\/code><\/span><\/pre>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>WebSockets<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 9 \u4e3a WebSockets \u5f15\u5165\u4e86\u5927\u5bb6\u671f\u76fc\u5df2\u4e45\u7684 PING\/PONG Keep-Alive \u7b56\u7565 (<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/48729\">dotnet\/runtime#48729<\/a>)\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 9 \u4e4b\u524d\uff0c\u552f\u4e00\u53ef\u7528\u7684 Keep-Alive \u7b56\u7565\u662f Unsolicited PONG\u3002\u5b83\u8db3\u4ee5\u9632\u6b62\u5e95\u5c42 TCP \u8fde\u63a5\u7a7a\u95f2\uff0c\u4f46\u5728\u8fdc\u7a0b\u4e3b\u673a\u65e0\u54cd\u5e94\u7684\u60c5\u51b5\u4e0b\uff08\u4f8b\u5982\uff0c\u8fdc\u7a0b\u670d\u52a1\u5668\u5d29\u6e83\uff09\uff0c\u800c\u68c0\u6d4b\u6b64\u7c7b\u60c5\u51b5\u7684\u552f\u4e00\u65b9\u6cd5\u662f\u4f9d\u8d56 TCP \u8d85\u65f6\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u6b64\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u7528\u65b0\u7684 <code>KeepAliveTimeout<\/code> \u8bbe\u7f6e\u8865\u5145\u4e86\u73b0\u6709\u7684 <code>KeepAliveInterval<\/code> \u8bbe\u7f6e\uff0c\u56e0\u6b64 Keep-Alive \u7b56\u7565\u7684\u9009\u62e9\u5982\u4e0b\uff1a\u00a0<\/span><\/p>\n<ol>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">Keep-Alive \u662f <b>OFF<\/b>\uff0c\u5f53\u00a0<\/span><\/li>\n<\/ol>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:1440,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"2\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>KeepAliveInterval<\/code> \u4e3a <code>TimeSpan.Zero<\/code> \u6216 <code>Timeout.InfiniteTimeSpan<\/code> \u65f6\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ol>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><b>Unsolicited PONG<\/b>\uff0c\u5f53\u00a0<\/span><\/li>\n<\/ol>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:1440,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"2\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>KeepAliveInterval<\/code> \u4e3a\u6b63\u6709\u9650 <code>TimeSpan<\/code> \u503c, -\u5e76\u4e14-<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:1440,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"2\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>KeepAliveTimeout<\/code> \u4e3a <code>TimeSpan.Zero<\/code> \u6216 <code>Timeout.InfiniteTimeSpan<\/code> \u65f6\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ol>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><b>PING\/PONG<\/b>\uff0c\u5f53\u00a0<\/span><\/li>\n<\/ol>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:1440,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"2\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>KeepAliveInterval<\/code> \u4e3a\u6b63\u6709\u9650 <code>TimeSpan<\/code> \u503c, -\u5e76\u4e14-\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"8\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:1440,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"2\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>KeepAliveTimeout<\/code> \u4e3a\u6b63\u6709\u9650 <code>TimeSpan<\/code> \u503c\u65f6\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5c06\u4fdd\u7559\u9884\u5148\u5b58\u5728\u7684 Keep-Alive \u884c\u4e3a\uff1a<code>KeepAliveTimeout<\/code> \u9ed8\u8ba4\u503c\u4e3a <code>Timeout.InfiniteTimeSpan<\/code>\uff0c\u56e0\u6b64 Unsolicited PONG \u4ecd\u7136\u662f\u9ed8\u8ba4\u7b56\u7565\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u4e0b\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u4e3a <code>ClientWebSocket<\/code> \u542f\u7528 PING\/PONG \u7b56\u7565\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">var cws = new ClientWebSocket();\r\ncws.Options.KeepAliveInterval = TimeSpan.FromSeconds(10);\r\ncws.Options.KeepAliveTimeout = TimeSpan.FromSeconds(10);\r\nawait cws.ConnectAsync(uri, cts.Token);\r\n\r\n\/\/ NOTE: There should be an outstanding read at all times to\r\n\/\/ ensure incoming PONGs are promptly processed\r\nvar result = await cws.ReceiveAsync(buffer, cts.Token);<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5982\u679c\u5728 <code>KeepAliveTimeout<\/code> \u65f6\u95f4\u8fc7\u53bb\u540e\u4ecd\u672a\u6536\u5230 PONG \u54cd\u5e94\uff0c\u5219\u8fdc\u7a0b\u7aef\u70b9\u5c06\u88ab\u89c6\u4e3a\u65e0\u54cd\u5e94\uff0cWebSocket \u8fde\u63a5\u5c06\u81ea\u52a8\u4e2d\u6b62\u3002\u540c\u65f6\uff0c\u4efb\u4f55\u672a\u5b8c\u6210\u7684 <code>ReceiveAsync<\/code> \u64cd\u4f5c\u90fd\u4f1a\u629b\u51fa <code>OperationCanceledException<\/code> \u4ee5\u89e3\u9664\u963b\u585e\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8981\u4e86\u89e3\u6709\u5173\u8be5\u529f\u80fd\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b<a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/websockets#keep-alive-strategies\">\u4e13\u95e8\u7684\u6982\u5ff5\u6587\u6863<\/a>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>.NET Framework \u517c\u5bb9\u6027<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u5c06\u9879\u76ee\u4ece .NET Framework \u8fc1\u79fb\u5230 .NET Core \u65f6\uff0c\u7f51\u7edc\u9886\u57df\u9762\u4e34\u7684\u6700\u5927\u969c\u788d\u4e4b\u4e00\u662f HTTP \u6280\u672f\u6808\u7684\u5dee\u5f02\u3002\u5728 .NET Framework \u4e2d\uff0c\u5904\u7406 HTTP \u8bf7\u6c42\u7684\u4e3b\u8981\u7c7b\u662f <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.httpwebrequest\">HttpWebRequest<\/a>\uff0c\u5b83\u4f9d\u8d56\u5168\u5c40\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.servicepointmanager\">ServicePointManager<\/a> \u4ee5\u53ca\u5404\u81ea\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.servicepoint\">ServicePoint<\/a> \u6765\u7ba1\u7406\u8fde\u63a5\u6c60\u3002\u800c\u5728 .NET Core \u4e2d\uff0c\u63a8\u8350\u7684\u65b9\u5f0f\u662f\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.httpclient\">HttpClient<\/a> \u6765\u8bbf\u95ee HTTP \u8d44\u6e90\u3002\u6b64\u5916\uff0c.NET Framework \u4e2d\u7684\u6240\u6709\u76f8\u5173\u7c7b\u5728 .NET \u4e2d\u4ecd\u7136\u5b58\u5728\uff0c\u4f46\u8981\u4e48\u5df2\u88ab\u6807\u8bb0\u4e3a\u8fc7\u65f6\uff0c\u8981\u4e48\u7f3a\u5c11\u5b9e\u73b0\uff0c\u6216\u8005\u6839\u672c\u4e0d\u518d\u7ef4\u62a4\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230\u4e00\u4e9b\u9519\u8bef\uff0c\u4f8b\u5982\u4f7f\u7528 <code>ServicePointManager<\/code> \u6765\u914d\u7f6e\u8fde\u63a5\u7684\u540c\u65f6\uff0c\u53c8\u4f7f\u7528 <code>HttpClient<\/code> \u8bbf\u95ee\u8d44\u6e90\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u7684\u5efa\u8bae\u59cb\u7ec8\u662f\u5b8c\u5168\u8fc1\u79fb\u5230 <code>HttpClient<\/code>\uff0c\u4f46\u6709\u65f6\u5019\u8fd9\u5e76\u4e0d\u73b0\u5b9e\u3002\u5c06\u9879\u76ee\u4ece .NET Framework \u8fc1\u79fb\u5230 .NET Core \u672c\u8eab\u5c31\u5df2\u76f8\u5f53\u56f0\u96be\uff0c\u66f4\u4e0d\u7528\u8bf4\u8fd8\u8981\u91cd\u5199\u6240\u6709\u7684\u7f51\u7edc\u4ee3\u7801\u3002\u671f\u671b\u7528\u6237\u5728\u4e00\u6b21\u8fc1\u79fb\u4e2d\u5b8c\u6210\u6240\u6709\u8fd9\u4e9b\u5de5\u4f5c\u5e76\u4e0d\u73b0\u5b9e\uff0c\u8fd9\u4e5f\u662f\u5bfc\u81f4\u8bb8\u591a\u7528\u6237\u5bf9\u8fc1\u79fb\u6301\u8c28\u614e\u6001\u5ea6\u7684\u539f\u56e0\u4e4b\u4e00\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u75db\u70b9\uff0c\u6211\u4eec\u8865\u5145\u4e86\u90e8\u5206 .NET Core \u4e4b\u524d\u7f3a\u5931\u7684\u65e7\u7c7b\u5b9e\u73b0\uff0c\u5e76\u63d0\u4f9b\u4e86\u4e00\u4efd\u5b8c\u6574\u7684\u8fc1\u79fb\u6307\u5357\u6765\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u987a\u5229\u5730\u5b8c\u6210\u8fc1\u79fb\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9996\u5148\uff0c\u6211\u4eec\u6269\u5c55\u4e86\u53d7\u652f\u6301\u7684 <code>ServicePointManager<\/code> \u548c <code>ServicePoint<\/code> \u4e2d\u4e00\u4e9b\u7f3a\u5931\u7684\u5c5e\u6027\uff0c\u8fd9\u4e9b\u5c5e\u6027\u6b64\u524d\u5728 .NET Core \u4e2d\u5c1a\u672a\u5b9e\u73b0\uff08\u89c1 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/94664\">dotnet\/runtime#94664<\/a> \u548c <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/97537\">dotnet\/runtime#97537<\/a>\uff09\u3002\u6709\u4e86\u8fd9\u4e9b\u53d8\u66f4\u540e\uff0c\u5b83\u4eec\u73b0\u5728\u53ef\u4ee5\u5728 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.httpwebrequest\">HttpWebRequest<\/a> \u4e2d\u88ab\u6b63\u786e\u5730\u4f7f\u7528\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5bf9\u4e8e <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.httpwebrequest\">HttpWebRequest<\/a>\uff0c\u6211\u4eec\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/95001\">dotnet\/runtime#95001<\/a> \u4e2d\u5b9e\u73b0\u4e86\u5bf9 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.httpwebrequest.allowwritestreambuffering\">AllowWriteStreamBuffering<\/a> \u7684\u5b8c\u5168\u652f\u6301\u3002\u6b64\u5916\uff0c\u8fd8\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/102038\">dotnet\/runtime#102038<\/a> \u4e2d\u6dfb\u52a0\u4e86\u5bf9 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.webrequest.impersonationlevel\">ImpersonationLevel<\/a> \u7684\u7f3a\u5931\u652f\u6301\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9664\u4e86\u8fd9\u4e9b\u66f4\u6539\u4e4b\u5916\uff0c\u6211\u4eec\u8fd8\u6dd8\u6c70\u4e86\u4e00\u4e9b\u65e7\u7248\u7c7b\uff0c\u4ee5\u9632\u6b62\u8fdb\u4e00\u6b65\u6df7\u6dc6\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"4\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u00a0<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.servicepointmanager\">ServicePointManager<\/a>\uff08\u89c1 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/103456\">dotnet\/runtime#103456<\/a>\uff09\u3002\u5b83\u7684\u8bbe\u7f6e\u5bf9 <code>HttpClient<\/code> \u548c <code>SslStream<\/code> \u6ca1\u6709\u4efb\u4f55\u5f71\u54cd\uff0c\u4f46\u5f88\u591a\u5f00\u53d1\u8005\u53ef\u80fd\u4ecd\u7136\u4f1a\u9519\u8bef\u5730\u5c1d\u8bd5\u4f7f\u7528\u5b83\u6765\u914d\u7f6e\u8fd9\u4e9b\u7ec4\u4ef6\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"9\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"5\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u00a0<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.authenticationmanager\">AuthenticationManager<\/a>\uff08\u89c1 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/93171\">dotnet\/runtime#93171<\/a>\uff09\uff0c\u8be5\u66f4\u6539\u7531\u793e\u533a\u8d21\u732e\u8005 <a href=\"https:\/\/github.com\/deeprobin\">@deeprobin<\/a> \u63d0\u4ea4\u3002\u8fd9\u4e2a\u7c7b\u8981\u4e48\u7f3a\u5c11\u5b9e\u73b0\uff0c\u8981\u4e48\u5176\u65b9\u6cd5\u76f4\u63a5\u629b\u51fa <code>PlatformNotSupportedException<\/code>\uff0c\u56e0\u6b64\u4e0d\u518d\u63a8\u8350\u4f7f\u7528\u3002\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u540e\uff0c\u6211\u4eec\u8fd8\u6574\u7406\u4e86\u4e00\u4efd\u8be6\u7ec6\u7684\u4ece <code>HttpWebRequest<\/code> \u8fc1\u79fb\u5230 <code>HttpClient<\/code> \u7684\u6307\u5357\uff08<a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/http\/httpclient-migrate-from-httpwebrequest\">HttpWebRequest to HttpClient migration guide<\/a>\uff09\u3002\u5b83\u5305\u62ec\u5404\u4e2a\u5c5e\u6027\u548c\u65b9\u6cd5\u4e4b\u95f4\u6620\u5c04\u7684\u7efc\u5408\u5217\u8868\uff0c\u4f8b\u5982<a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/http\/httpclient-migrate-from-httpwebrequest#migrate-servicepointmanager-usage\">\u8fc1\u79fb ServicePoint(Manager) \u7528\u6cd5<\/a>\uff0c\u4ee5\u53ca\u8bb8\u591a\u7b80\u5355\u548c\u4e0d\u90a3\u4e48\u7b80\u5355\u7684\u573a\u666f\u7684\u793a\u4f8b\uff0c\u4f8b\u5982<em><a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/http\/httpclient-migrate-from-httpwebrequest#example-enable-dns-round-robin\">\u793a\u4f8b\uff1a\u542f\u7528 DNS \u8f6e\u8be2<\/a><\/em>\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><span style=\"font-size: 18pt;\"><b>\u8bca\u65ad\u5de5\u5177<\/b><\/span>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u6b64\u7248\u672c\u4e2d\uff0c\u8bca\u65ad\u5de5\u5177\u7684\u4f18\u5316\u91cd\u70b9\u5728\u4e8e\u589e\u5f3a\u9690\u79c1\u4fdd\u62a4\u548c\u63d0\u5347\u5206\u5e03\u5f0f\u8ffd\u8e2a\u80fd\u529b\u3002\u00a0<\/span><\/p>\n<p aria-level=\"3\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><b>HttpClientFactory \u65e5\u5fd7\u4e2d\u7684 Uri \u67e5\u8be2\u53c2\u6570\u8131\u654f<\/b>\u00a0<\/span><\/p>\n<p aria-level=\"3\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Extensions.Http\">Microsoft.Extensions.Http<\/a> 9.0.0 \u7248\u672c\u5f00\u59cb\uff0c<code>HttpClientFactory<\/code> \u65e5\u5fd7\u903b\u8f91\u9ed8\u8ba4\u4f18\u5148\u4fdd\u62a4\u9690\u79c1\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u65e7\u7248\u672c\u4e2d\uff0c\u5b83\u4f1a\u5728 <code>RequestStart<\/code> \u548c <code>RequestPipelineStart<\/code> \u4e8b\u4ef6\u4e2d\u8bb0\u5f55\u5b8c\u6574\u7684\u8bf7\u6c42 URI\u3002\u5982\u679c URI \u7684\u67d0\u4e9b\u90e8\u5206\u5305\u542b\u654f\u611f\u4fe1\u606f\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u6570\u636e\u6cc4\u9732\uff0c\u4ece\u800c\u5f15\u53d1\u9690\u79c1\u95ee\u9898\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">8.0.0\u7248\u672c\u5f15\u5165\u4e86\u901a\u8fc7<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-8-networking-improvements\/#modify-httpclient-logging\">\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8bb0\u5f55<\/a>\u6765\u63d0\u9ad8\u4f7f\u7528\u00a0<code>HttpClientFactory<\/code> \u7684\u5b89\u5168\u6027\u3002\u4f46\u8fd9\u6539\u53d8\u4e0d\u4e86\u9ed8\u8ba4\u884c\u4e3a\u4ecd\u53ef\u80fd\u5bf9\u4e0d\u77e5\u60c5\u7684\u7528\u6237\u6784\u6210\u98ce\u9669\u7684\u73b0\u5b9e\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5927\u591a\u6570\u6709\u95ee\u9898\u7684\u60c5\u51b5\u4e0b\uff0c\u654f\u611f\u4fe1\u606f\u5b58\u5728\u4e8e\u67e5\u8be2\u7ec4\u4ef6\u4e2d\u3002\u56e0\u6b64\uff0c\u5728 9.0.0 \u7248\u672c\u4e2d\u5f15\u5165\u4e86\u4e00\u9879<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/networking\/9.0\/query-redaction-logs\">\u91cd\u5927\u53d8\u66f4<\/a>\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4f1a\u4ece <code>HttpClientFactory<\/code> \u65e5\u5fd7\u4e2d\u79fb\u9664\u6574\u4e2a\u67e5\u8be2\u5b57\u7b26\u4e32\u3002\u4e3a\u670d\u52a1\/\u5e94\u7528\u63d0\u4f9b\u4e86\u4e00\u4e2a\u5168\u5c40<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/networking\/9.0\/query-redaction-logs#recommended-action\">\u53ef\u9009\u5f00\u5173<\/a>\u6765\u5b89\u5168\u8bb0\u5f55\u5b8c\u6574 URI\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4e3a\u4e86\u4e00\u81f4\u6027\u548c\u66f4\u9ad8\u7684\u5b89\u5168\u6027\uff0c<code>System.Net.Http<\/code> \u4e2d\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.diagnostics.tracing.eventsource\">EventSource<\/a> \u4e8b\u4ef6\u4e5f\u8fdb\u884c\u4e86<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/networking\/9.0\/query-redaction-events\">\u7c7b\u4f3c\u7684\u4fee\u6539<\/a>\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6211\u4eec\u77e5\u9053\u8fd9\u79cd\u89e3\u51b3\u65b9\u6848\u53ef\u80fd\u5e76\u4e0d\u9002\u7528\u4e8e\u6240\u6709\u60c5\u51b5\u3002\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u5e94\u8be5\u63d0\u4f9b\u66f4\u7ec6\u7c92\u5ea6\u7684 URI \u8fc7\u6ee4\u673a\u5236\uff0c\u5141\u8bb8\u7528\u6237\u4fdd\u7559\u975e\u654f\u611f\u7684\u67e5\u8be2\u53c2\u6570\uff0c\u6216\u8005\u5bf9\u5176\u4ed6 URI \u7ec4\u4ef6\uff08\u4f8b\u5982\u8def\u5f84\u7684\u4e00\u90e8\u5206\uff09\u8fdb\u884c\u8fc7\u6ee4\u3002\u6211\u4eec\u8ba1\u5212\u5728\u672a\u6765\u7248\u672c\u4e2d\u63a2\u7d22\u6b64\u7c7b\u529f\u80fd\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/110018\">dotnet\/runtime#110018<\/a>\uff09\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u5206\u5e03\u5f0f\u8ffd\u8e2a\u4f18\u5316<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/diagnostics\/distributed-tracing\">\u5206\u5e03\u5f0f\u8ffd\u8e2a<\/a>\u662f\u4e00\u79cd\u8bca\u65ad\u6280\u672f\uff0c\u7528\u4e8e\u8ddf\u8e2a\u7279\u5b9a\u4e8b\u52a1\u5728\u591a\u4e2a\u8fdb\u7a0b\u548c\u673a\u5668\u4e0a\u7684\u8def\u5f84\uff0c\u4ece\u800c\u5e2e\u52a9\u8bc6\u522b\u74f6\u9888\u548c\u6545\u969c\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u79cd\u6280\u672f\u5c06\u4e8b\u52a1\u5efa\u6a21\u4e3a<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/diagnostics\/distributed-tracing-concepts#traces-and-activities\">\u6d3b\u52a8<\/a>\u7684\u5206\u5c42\u6811\uff0c\u5728 OpenTelemetry \u672f\u8bed\u4e2d\uff0c\u8fd9\u4e9b\u6d3b\u52a8\u901a\u5e38\u88ab\u79f0\u4e3a<a href=\"https:\/\/opentelemetry.io\/docs\/concepts\/signals\/traces\/#spans\">\u8de8\u5ea6<\/a>\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u542f\u7528\u8ffd\u8e2a\u65f6\uff0c<code>HttpClientHandler<\/code> \u548c <code>SocketsHttpHandler<\/code> \u90fd\u4f1a\u4e3a\u6bcf\u4e2a\u8bf7\u6c42\u542f\u52a8\u4e00\u4e2a\u6d3b\u52a8\uff0c\u5e76\u901a\u8fc7\u6807\u51c6\u7684 W3C \u5934\u4f20\u64ad<a href=\"https:\/\/www.w3.org\/TR\/trace-context\/\">\u8ffd\u8e2a\u4e0a\u4e0b\u6587<\/a>\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 9 \u4e4b\u524d\uff0c\u7528\u6237\u9700\u8981\u4f7f\u7528 OpenTelemetry .NET SDK \u6765\u751f\u6210\u7b26\u5408 OpenTelemetry \u6807\u51c6\u7684\u6709\u7528\u8ffd\u8e2a\u3002\u8fd9\u4e2a SDK \u4e0d\u4ec5\u7528\u4e8e\u6536\u96c6\u548c\u5bfc\u51fa\u6570\u636e\uff0c\u8fd8\u7528\u4e8e<a href=\"https:\/\/github.com\/open-telemetry\/opentelemetry-dotnet-contrib\/blob\/85afc5dd1bd7deef9b8949f36a14cd3fd1aacecb\/src\/OpenTelemetry.Instrumentation.Http\/README.md\">\u589e\u5f3a\u76d1\u63a7\u80fd\u529b<\/a>\uff0c\u56e0\u4e3a\u5185\u7f6e\u7684\u903b\u8f91\u5e76\u4e0d\u4f1a\u586b\u5145\u8bf7\u6c42\u6570\u636e\u5230\u6d3b\u52a8\u4e2d\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece .NET 9 \u5f00\u59cb\uff0c\u9664\u975e\u9700\u8981\u4f7f\u7528enrichment\u7b49\u9ad8\u7ea7\u529f\u80fd\uff0c\u5426\u5219\u68c0\u6d4b\u4f9d\u8d56\u9879\uff08<code>OpenTelemetry.Instrumentation.Http<\/code>\uff09\u53ef\u4ee5\u7701\u7565\u3002\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/104251\">dotnet\/runtime#104251<\/a> \u4e2d\uff0c\u6211\u4eec\u6269\u5c55\u4e86\u5185\u7f6e\u7684\u8ffd\u8e2a\u529f\u80fd\uff0c\u786e\u4fdd\u6d3b\u52a8\u7684\u7ed3\u6784\u7b26\u5408 <a href=\"https:\/\/opentelemetry.io\/docs\/specs\/semconv\/http\/http-spans\/#http-client\">OTel \u6807\u51c6<\/a>\uff0c\u540d\u79f0\u3001\u72b6\u6001\u548c\u5927\u591a\u6570\u5fc5\u9700\u7684\u6807\u7b7e\u90fd\u6839\u636e\u6807\u51c6\u8fdb\u884c\u4e86\u586b\u5145\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u5b9e\u9a8c\u6027\u8fde\u63a5\u8ffd\u8e2a<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u8c03\u67e5\u74f6\u9888\u65f6\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u6df1\u5165\u4e86\u89e3\u7279\u5b9a\u7684 HTTP \u8bf7\u6c42\uff0c\u4ee5\u8bc6\u522b\u5927\u90e8\u5206\u65f6\u95f4\u82b1\u8d39\u5728\u54ea\u91cc\u3002\u662f\u5728\u5efa\u7acb\u8fde\u63a5\u65f6\uff0c\u8fd8\u662f\u5728\u5185\u5bb9\u4e0b\u8f7d\u65f6\uff1f\u5f53\u9047\u5230\u8fde\u63a5\u95ee\u9898\uff0c\u5982\u679c\u80fd\u591f\u786e\u5b9a\u95ee\u9898\u662f\u51fa\u5728 DNS \u67e5\u627e\u3001TCP \u8fde\u63a5\u5efa\u7acb\uff0c\u8fd8\u662f TLS \u63e1\u624b\u7684\u8bdd\uff0c\u8fd9\u5c06\u4f1a\u975e\u5e38\u6709\u5e2e\u52a9\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">.NET 9 \u5f15\u5165\u4e86\u51e0\u4e2a\u65b0\u7684\u8de8\u5ea6\uff0c\u4ee5\u8868\u793a <code>SocketsHttpHandler<\/code> \u4e2d\u4e0e\u8fde\u63a5\u5efa\u7acb\u76f8\u5173\u7684\u6d3b\u52a8\u3002\u5176\u4e2d\u6700\u91cd\u8981\u7684\u662f HTTP \u8fde\u63a5\u8bbe\u7f6e\u8de8\u5ea6\uff0c\u5b83\u7ec6\u5206\u4e3a DNS\u3001TCP \u548c TLS \u6d3b\u52a8\u7684\u4e09\u4e2a\u5b50\u8de8\u5ea6\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7531\u4e8e\u8fde\u63a5\u8bbe\u7f6e\u4e0d\u4f9d\u8d56\u4e8e <code>SocketsHttpHandler<\/code> \u8fde\u63a5\u6c60\u4e2d\u7684\u7279\u5b9a\u8bf7\u6c42\uff0c\u56e0\u6b64\u8fde\u63a5\u8bbe\u7f6e\u8de8\u5ea6\u65e0\u6cd5\u88ab\u5efa\u6a21\u4e3a HTTP \u5ba2\u6237\u7aef\u8bf7\u6c42\u8de8\u5ea6\u7684\u5b50\u8de8\u5ea6\u3002\u76f8\u53cd\uff0c\u8bf7\u6c42\u548c\u8fde\u63a5\u4e4b\u95f4\u7684\u5173\u7cfb\u4f7f\u7528<a href=\"https:\/\/opentelemetry.io\/docs\/concepts\/signals\/traces\/#span-links\">\u8de8\u5ea6\u94fe\u63a5<\/a>\uff08\u4e5f\u79f0\u4e3a\u6d3b\u52a8\u94fe\u63a5\uff09\u3002\u00a0<\/span><\/p>\n<p data-ccp-border-top=\"0.6666666666666666px solid #7030a0\" data-ccp-padding-top=\"5.333333333333333px\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><div class=\"alert alert-primary\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Info\"><\/i><strong>\u6ce8\u610f<\/strong><\/p>\u8fd9\u4e9b\u65b0\u8de8\u5ea6\u7531\u5339\u914d\u901a\u914d\u7b26 <code>Experimental.System.Net.*<\/code> \u7684\u5404\u79cd ActivitySources \u751f\u6210\u3002\u8fd9\u4e9b\u8de8\u5ea6\u662f\u5b9e\u9a8c\u6027\u7684\uff0c\u56e0\u4e3a\u50cf <a href=\"https:\/\/learn.microsoft.com\/azure\/azure-monitor\/app\/app-insights-overview\">Azure Monitor Application Insights<\/a> \u8fd9\u6837\u7684\u76d1\u63a7\u5de5\u5177\u5f88\u96be\u6709\u6548\u5730\u53ef\u89c6\u5316\u751f\u6210\u7684\u8ffd\u8e2a\u4fe1\u606f\uff0c\u539f\u56e0\u662f\u5b58\u5728\u5927\u91cf\u7684 <code>connection_setup \u2192 request<\/code> \u7684\u53cd\u5411\u94fe\u63a5\u3002\u4e3a\u4e86\u6539\u5584\u76d1\u63a7\u5de5\u5177\u4e2d\u7684\u7528\u6237\u4f53\u9a8c\uff0c\u4ecd\u9700\u8981\u8fdb\u4e00\u6b65\u7684\u5de5\u4f5c\u3002\u8fd9\u9879\u5de5\u4f5c\u6d89\u53ca .NET \u56e2\u961f\u3001OTel \u548c\u5de5\u5177\u4f5c\u8005\u7684\u5408\u4f5c\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u65b0\u8de8\u5ea6\u8bbe\u8ba1\u7684\u91cd\u5927\u53d8\u66f4\u3002\u00a0<\/div><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8bbe\u7f6e\u548c\u5c1d\u8bd5\u8fde\u63a5\u8ddf\u8e2a\u6536\u96c6\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/aspire\/get-started\/aspire-overview\">.NET Aspire<\/a>\u3002\u901a\u8fc7 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/aspire\/fundamentals\/dashboard\/overview\">Aspire Dashboards<\/a>\uff0c\u60a8\u53ef\u4ee5\u5c55\u5f00 connection_setup \u6d3b\u52a8\uff0c\u5e76\u67e5\u770b\u8fde\u63a5\u521d\u59cb\u5316\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\" data-ccp-props=\"{&quot;335559738&quot;:240,&quot;335559739&quot;:240}\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup.png\"><img decoding=\"async\" class=\"alignnone wp-image-1020\" src=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup-300x42.png\" alt=\"Image connection setup\" width=\"714\" height=\"100\" srcset=\"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup-300x42.png 300w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup-1024x143.png 1024w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup-768x107.png 768w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup-1536x215.png 1536w, https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-content\/uploads\/sites\/75\/2025\/02\/connection-setup.png 1902w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><\/a><\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5982\u679c\u60a8\u8ba4\u4e3a .NET 9 \u7684\u8ffd\u8e2a\u65b0\u589e\u529f\u80fd\u53ef\u80fd\u4e3a\u60a8\u5e26\u6765\u6709\u4ef7\u503c\u7684\u8bca\u65ad\u89c1\u89e3\uff0c\u5e76\u4e14\u60f3\u8981\u4eb2\u81ea\u4f53\u9a8c\u4e00\u4e0b\uff0c\u8bf7\u968f\u65f6\u9605\u8bfb\u6211\u4eec\u5173\u4e8e <a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/networking\/telemetry\/tracing\">System.Net \u5e93\u4e2d\u5206\u5e03\u5f0f\u8ffd\u8e2a<\/a>\u7684\u5b8c\u6574\u6587\u7ae0\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>HttpClientFactory<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5bf9\u4e8e <code>HttpClientFactory<\/code>\uff0c\u6211\u4eec\u5f15\u5165\u4e86 Keyed DI \u652f\u6301\uff0c\u63d0\u4f9b\u4e86\u4e00\u79cd\u65b0\u7684\u4fbf\u6377\u4f7f\u7528\u6a21\u5f0f\uff0c\u5e76\u66f4\u6539\u4e86\u9ed8\u8ba4\u7684 Primary Handler\uff0c\u4ee5\u51cf\u5c11\u5e38\u89c1\u7684\u9519\u8bef\u4f7f\u7528\u60c5\u51b5\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><span style=\"font-size: 14pt;\"><b>Keyed DI \u652f\u6301<\/b><\/span>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/dependency-injection?source=recommendations#keyed-services\">Keyed Services<\/a> \u88ab\u5f15\u5165\u5230 <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Extensions.DependencyInjection\">Microsoft.Extensions.DependencyInjection<\/a> \u5305\u4e2d\u3002Keyed DI \u5141\u8bb8\u60a8\u5728\u6ce8\u518c\u5355\u4e00\u670d\u52a1\u7c7b\u578b\u7684\u591a\u4e2a\u5b9e\u73b0\u65f6\u6307\u5b9a\u952e\u503c\uff0c\u5e76\u968f\u540e\u4f7f\u7528\u76f8\u5e94\u7684\u952e\u503c\u6765\u68c0\u7d22\u7279\u5b9a\u7684\u5b9e\u73b0\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>HttpClientFactory<\/code> \u548c\u547d\u540d\u7684 <code>HttpClient<\/code> \u5b9e\u4f8b\u4e0e Keyed Services \u7684\u7406\u5ff5\u975e\u5e38\u5951\u5408\u3002<code>HttpClientFactory<\/code> \u662f\u4e00\u79cd\u5f25\u8865\u957f\u671f\u4ee5\u6765\u7f3a\u5931\u7684 DI \u529f\u80fd\u7684\u65b9\u5f0f\u3002\u4f46\u5b83\u8981\u6c42\u60a8\u83b7\u53d6\u3001\u5b58\u50a8\u5e76\u67e5\u8be2 <code>IHttpClientFactory<\/code> \u5b9e\u4f8b\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u6ce8\u5165\u4e00\u4e2a\u914d\u7f6e\u597d\u7684 HttpClient\uff0c\u8fd9\u53ef\u80fd\u4e0d\u592a\u65b9\u4fbf\u3002\u867d\u7136\u7c7b\u578b\u5316\u5ba2\u6237\u7aef\uff08Typed clients\uff09\u8bd5\u56fe\u7b80\u5316\u8fd9\u4e00\u90e8\u5206\uff0c\u4f46\u5b83\u4e5f\u6709\u4e00\u4e2a\u7f3a\u70b9\uff1a\u7c7b\u578b\u5316\u5ba2\u6237\u7aef\u5bb9\u6613<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory-troubleshooting#typed-client-has-the-wrong-httpclient-injected\">\u914d\u7f6e\u9519\u8bef<\/a>\u548c<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory#avoid-typed-clients-in-singleton-services\">\u8bef\u7528<\/a>\uff08\u5728<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/66863\">\u67d0\u4e9b\u573a\u666f<\/a>\u4e2d\uff0c\u652f\u6301\u57fa\u7840\u8bbe\u65bd\u4e5f\u53ef\u80fd\u5e26\u6765\u660e\u663e\u7684\u5f00\u9500\uff09\u3002\u56e0\u6b64\uff0c\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\u7684\u7528\u6237\u4f53\u9a8c\u90fd\u4e0d\u592a\u7406\u60f3\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u4e00\u60c5\u51b5\u5f97\u5230\u4e86\u6539\u53d8\uff0c\u56e0\u4e3a <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Extensions.DependencyInjection\">Microsoft.Extensions.DependencyInjection<\/a> 9.0.0 \u548c <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Extensions.Http\">Microsoft.Extensions.Http<\/a> 9.0.0 \u5305\u5c06 Keyed DI \u652f\u6301\u5f15\u5165 HttpClientFactory\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/89755\">dotnet\/runtime#89755<\/a>\uff09\u3002\u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u83b7\u5f97\u4e24\u5168\u5176\u7f8e\u7684\u4f53\u9a8c\uff1a\u65e2\u53ef\u4ee5\u4f7f\u7528\u65b9\u4fbf\u4e14\u9ad8\u5ea6\u53ef\u914d\u7f6e\u7684 HttpClient \u6ce8\u518c\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u6ce8\u5165\u7279\u5b9a\u7684\u5df2\u914d\u7f6e HttpClient \u5b9e\u4f8b\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ece 9.0.0 \u5f00\u59cb\uff0c\u60a8\u9700\u8981\u901a\u8fc7\u8c03\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/microsoft.extensions.dependencyinjection.httpclientbuilderextensions.addaskeyed\">AddAsKeyed()<\/a> \u6269\u5c55\u65b9\u6cd5\u6765\u542f\u7528\u6b64\u529f\u80fd\u3002\u5b83\u4f1a\u5c06\u547d\u540d\u7684 HttpClient \u6ce8\u518c\u4e3a\u4e00\u4e2a\u952e\u63a7\u670d\u52a1\uff0c\u952e\u503c\u7b49\u4e8e\u5ba2\u6237\u7aef\u7684\u540d\u79f0\uff0c\u5e76\u5141\u8bb8\u60a8\u4f7f\u7528 Keyed Services API\uff08\u4f8b\u5982 [<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/microsoft.extensions.dependencyinjection.fromkeyedservicesattribute\">FromKeyedServices(&#8230;)<\/a>]\uff09\u6765\u83b7\u53d6\u6240\u9700\u7684 HttpClient\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86 HttpClientFactory\u3001Keyed DI \u548c ASP.NET Core 9.0 Minimal API \u4e4b\u95f4\u7684\u96c6\u6210\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">var builder = WebApplication.CreateBuilder(args);\r\n\r\nbuilder.Services.AddHttpClient(\"github\", c =&gt;\r\n    {\r\n        c.BaseAddress = new Uri(\"https:\/\/api.github.com\/\");\r\n        c.DefaultRequestHeaders.Add(\"Accept\", \"application\/vnd.github.v3+json\");\r\n        c.DefaultRequestHeaders.Add(\"User-Agent\", \"dotnet\");\r\n    })\r\n    .AddAsKeyed(); \/\/ Add HttpClient as a Keyed Scoped service for key=\"github\"\r\n\r\nvar app = builder.Build();\r\n\r\n\/\/ Directly inject the Keyed HttpClient by its name\r\napp.MapGet(\"\/\", ([FromKeyedServices(\"github\")] HttpClient httpClient) =&gt;\r\n    httpClient.GetFromJsonAsync&lt;Repo&gt;(\"\/repos\/dotnet\/runtime\"));\r\n\r\napp.Run();\r\n\r\nrecord Repo(string Name, string Url);<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7aef\u70b9\u54cd\u5e94\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">&gt; ~  curl http:\/\/localhost:5000\/\r\n{\"name\":\"runtime\",\"url\":\"https:\/\/api.github.com\/repos\/dotnet\/runtime\"}<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code>AddAsKeyed()<\/code> \u5c06 <code>HttpClient<\/code> \u6ce8\u518c\u4e3a Keyed Scoped \u670d\u52a1\u3002Scoped \u751f\u547d\u5468\u671f\u6709\u52a9\u4e8e\u6355\u83b7\u4f9d\u8d56\u5173\u7cfb\u7684\u60c5\u51b5\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.AddHttpClient(\"scoped\").AddAsKeyed();\r\nservices.AddSingleton&lt;CapturingSingleton&gt;();\r\n\r\n\/\/ Throws: Cannot resolve scoped service 'System.Net.Http.HttpClient' from root provider.\r\nrootProvider.GetRequiredKeyedService&lt;HttpClient&gt;(\"scoped\");\r\n\r\nusing var scope = provider.CreateScope();\r\nscope.ServiceProvider.GetRequiredKeyedService&lt;HttpClient&gt;(\"scoped\"); \/\/ OK\r\n\r\n\/\/ Throws: Cannot consume scoped service 'System.Net.Http.HttpClient' from singleton 'CapturingSingleton'.\r\npublic class CapturingSingleton([FromKeyedServices(\"scoped\")] HttpClient httpClient)\r\n\/\/{ ...<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u5c06 <code>ServiceLifetime<\/code> \u53c2\u6570\u4f20\u9012\u7ed9 <code>AddAsKeyed()<\/code> \u65b9\u6cd5\u6765\u660e\u786e\u6307\u5b9a\u751f\u5b58\u5468\u671f\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.AddHttpClient(\"explicit-scoped\")\r\n    .AddAsKeyed(ServiceLifetime.Scoped);\r\n\r\nservices.AddHttpClient(\"singleton\")\r\n    .AddAsKeyed(ServiceLifetime.Singleton);<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u60a8\u4e0d\u5fc5\u4e3a\u6bcf\u4e2a\u5ba2\u6237\u7aef\u90fd\u8c03\u7528 <code>AddAsKeyed<\/code>\uff0c \u60a8\u53ef\u4ee5\u901a\u8fc7 <code>ConfigureHttpClientDefaults<\/code> \u8f7b\u677e\u5730\u201c\u5168\u5c40\u201d\u542f\u7528\uff08\u9002\u7528\u4e8e\u4efb\u4f55\u5ba2\u6237\u7aef\u540d\u79f0\uff09\u3002\u4ece Keyed Services \u7684\u89d2\u5ea6\u6765\u770b\uff0c\u8fd9\u5c06\u5b9e\u73b0 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/microsoft.extensions.dependencyinjection.keyedservice.anykey\">KeyedService.AnyKey<\/a> \u6ce8\u518c\u3002\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.ConfigureHttpClientDefaults(b =&gt; b.AddAsKeyed());\r\n\r\nservices.AddHttpClient(\"foo\", \/* ... *\/);\r\nservices.AddHttpClient(\"bar\", \/* ... *\/);\r\n\r\npublic class MyController(\r\n    [FromKeyedServices(\"foo\")] HttpClient foo,\r\n    [FromKeyedServices(\"bar\")] HttpClient bar)\r\n\/\/{ ...<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5c3d\u7ba1\u201c\u5168\u5c40\u201d\u542f\u7528\u662f\u4e00\u4e2a\u5355\u884c\u4ee3\u7801\uff0c\u4f46\u9057\u61be\u7684\u662f\u8be5\u529f\u80fd\u4ecd\u7136\u9700\u8981\u663e\u5f0f\u8c03\u7528\uff0c\u800c\u4e0d\u662f\u201c\u5f00\u7bb1\u5373\u7528\u201d\u3002\u6709\u5173\u8be5\u51b3\u7b56\u7684\u5b8c\u6574\u80cc\u666f\u548c\u539f\u56e0\uff0c\u8bf7\u53c2\u9605 <a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/89755\">dotnet\/runtime#89755<\/a> \u548c <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/104943\">dotnet\/runtime#104943<\/a>\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u60a8\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/microsoft.extensions.dependencyinjection.httpclientbuilderextensions.removeaskeyed\">RemoveAsKeyed()<\/a> \u660e\u786e\u5730\u4ece <code>HttpClients<\/code> \u4e2d\u79fb\u9664 Keyed DI\uff08\u4f8b\u5982\uff0c\u5728\u201c\u5168\u5c40\u201d\u542f\u7528\u7684\u60c5\u51b5\u4e0b\uff0c\u4e3a\u7279\u5b9a\u5ba2\u6237\u7aef\u79fb\u9664\u5b83\uff09\u3002\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.ConfigureHttpClientDefaults(b =&gt; b.AddAsKeyed());      \/\/ opt IN by default\r\nservices.AddHttpClient(\"keyed\", \/* ... *\/);\r\nservices.AddHttpClient(\"not-keyed\", \/* ... *\/).RemoveAsKeyed(); \/\/ opt OUT per name\r\n\r\nprovider.GetRequiredKeyedService&lt;HttpClient&gt;(\"keyed\");     \/\/ OK\r\nprovider.GetRequiredKeyedService&lt;HttpClient&gt;(\"not-keyed\"); \/\/ Throws: No service for type 'System.Net.Http.HttpClient' has been registered.\r\nprovider.GetRequiredKeyedService&lt;HttpClient&gt;(\"unknown\");   \/\/ OK (unconfigured instance)<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5982\u679c <code>AddAsKeyed()<\/code> \u548c <code>RemoveAsKeyed()<\/code> \u4e00\u8d77\u8c03\u7528\uff0c\u6216\u8005\u5176\u4e2d\u4efb\u4f55\u4e00\u4e2a\u8c03\u7528\u8d85\u8fc7\u4e00\u6b21\uff0c\u5b83\u4eec\u901a\u5e38\u9075\u5faa <code>HttpClientFactory<\/code> \u914d\u7f6e\u548c DI \u6ce8\u518c\u7684\u89c4\u5219\uff1a\u00a0<\/span><\/p>\n<ol>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u5728\u76f8\u540c\u7684\u540d\u79f0\u4e0b\u4f7f\u7528\uff0c\u6700\u540e\u4e00\u4e2a\u8bbe\u7f6e\u751f\u6548\uff1a<code>AddAsKeyed()<\/code> \u7684\u6700\u540e\u4e00\u4e2a\u751f\u547d\u5468\u671f\u8bbe\u7f6e\u5c06\u7528\u4e8e\u521b\u5efa Keyed \u6ce8\u518c\uff08\u9664\u975e\u6700\u540e\u8c03\u7528\u7684\u662f <code>RemoveAsKeyed()<\/code>\uff0c\u6b64\u65f6\u8be5\u540d\u79f0\u5c06\u88ab\u6392\u9664\uff09\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u4ec5\u5728 <code>ConfigureHttpClientDefaults<\/code> \u4e2d\u4f7f\u7528\uff0c\u6700\u540e\u4e00\u4e2a\u8bbe\u7f6e\u751f\u6548\u3002\u00a0<\/span><\/li>\n<li><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5f53\u540c\u65f6\u4f7f\u7528\u4e86 <code>ConfigureHttpClientDefaults<\/code> \u548c\u7279\u5b9a\u5ba2\u6237\u7aef\u540d\u79f0\uff0c\u5219\u6240\u6709\u9ed8\u8ba4\u8bbe\u7f6e\u5728\u6240\u6709\u6309\u540d\u79f0\u7684\u8bbe\u7f6e\u4e4b\u524d\u201c\u53d1\u751f\u201d\u3002\u56e0\u6b64\uff0c\u9ed8\u8ba4\u8bbe\u7f6e\u53ef\u4ee5\u88ab\u5ffd\u7565\uff0c\u6700\u540e\u4e00\u4e2a\u6309\u540d\u79f0\u7684\u8bbe\u7f6e\u751f\u6548\u3002\u00a0<\/span><\/li>\n<\/ol>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u60a8\u53ef\u4ee5\u5728<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory-keyed-di\">\u4e13\u95e8\u7684\u6982\u5ff5\u6587\u6863<\/a>\u4e2d\u4e86\u89e3\u6709\u5173\u6b64\u529f\u80fd\u7684\u66f4\u591a\u4fe1\u606f\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u9ed8\u8ba4\u4e3b\u5904\u7406\u7a0b\u5e8f\u66f4\u6539<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u4f7f\u7528 <code>HttpClientFactory<\/code> \u7684\u7528\u6237\u6700\u5e38\u9047\u5230\u7684\u95ee\u9898\u4e4b\u4e00\u662f\uff1a\u5f53\u4e00\u4e2a\u547d\u540d\u6216\u7c7b\u578b\u5316\u5ba2\u6237\u7aef\u88ab\u9519\u8bef\u5730<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory#avoid-typed-clients-in-singleton-services\">\u6355\u83b7\u5728\u4e00\u4e2a\u5355\u4f8b\u670d\u52a1\u4e2d<\/a>\uff0c\u6216\u8005\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u88ab\u5b58\u50a8\u7684\u65f6\u95f4\u8d85\u8fc7\u4e86\u6307\u5b9a\u7684 <code>HandlerLifetime<\/code>\u3002\u7531\u4e8e <code>HttpClientFactory<\/code> \u65e0\u6cd5\u8f6e\u6362\u8fd9\u4e9b\u5904\u7406\u7a0b\u5e8f\uff0c\u5b83\u4eec\u53ef\u80fd\u6700\u7ec8<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory-troubleshooting#httpclient-doesnt-respect-dns-changes\">\u65e0\u6cd5\u6b63\u786e\u54cd\u5e94 DNS \u53d8\u5316<\/a>\u3002\u4e0d\u5e78\u7684\u662f\uff0c\u5c06\u7c7b\u578b\u5316\u5ba2\u6237\u7aef\u6ce8\u5165\u5355\u4f8b\u670d\u52a1\u770b\u8d77\u6765\u5f88\u76f4\u89c2\u4e14\u201c\u5408\u7406\u201d\uff0c\u4f46\u5f88\u96be\u901a\u8fc7\u4efb\u4f55\u68c0\u67e5\u6216\u5206\u6790\u5668\u786e\u4fdd <code>HttpClient<\/code> \u6ca1\u6709\u88ab\u9519\u8bef\u5730\u6355\u83b7\uff0c\u8fd9\u4e5f\u4f7f\u5f97\u6545\u969c\u6392\u67e5\u53d8\u5f97\u66f4\u52a0\u56f0\u96be\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u53e6\u4e00\u65b9\u9762\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 <code>SocketsHttpHandler<\/code> \u6765<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/extensions\/httpclient-factory#using-ihttpclientfactory-together-with-socketshttphandler\">\u7f13\u89e3<\/a>\u6b64\u95ee\u9898\uff0c\u5b83\u53ef\u4ee5\u63a7\u5236 <code>PooledConnectionLifetime<\/code>\u3002\u4e0e <code>HandlerLifetime<\/code> \u7c7b\u4f3c\uff0c\u8be5\u5c5e\u6027\u5141\u8bb8\u5b9a\u671f\u91cd\u65b0\u521b\u5efa\u8fde\u63a5\uff0c\u4ee5\u4fbf\u6355\u83b7 DNS \u53d8\u5316\uff0c\u4f46\u4f5c\u7528\u5c42\u7ea7\u66f4\u4f4e\u3002\u5982\u679c\u4e3a\u5ba2\u6237\u7aef\u8bbe\u7f6e\u4e86 <code>PooledConnectionLifetime<\/code>\uff0c\u5219\u53ef\u4ee5\u5b89\u5168\u5730\u5c06\u5176\u7528\u4f5c\u5355\u4f8b\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u56e0\u6b64\uff0c\u4e3a\u4e86\u6700\u5927\u7a0b\u5ea6\u5730\u51cf\u5c11\u9519\u8bef\u4f7f\u7528\u6a21\u5f0f\u7684\u5f71\u54cd\uff0c.NET 9 \u5728\u652f\u6301\u7684\u5e73\u53f0\u4e0a\u9ed8\u8ba4\u4f7f\u7528 <code>SocketsHttpHandler<\/code> \u4f5c\u4e3a\u4e3b\u5904\u7406\u7a0b\u5e8f\uff08\u5176\u4ed6\u5e73\u53f0\uff0c\u5982 .NET Framework\uff0c\u4ecd\u7136\u4f7f\u7528 <code>HttpClientHandler<\/code>\uff09\u3002\u66f4\u91cd\u8981\u7684\u662f\uff0c<code>SocketsHttpHandler<\/code> \u7684 <code>PooledConnectionLifetime<\/code> \u5c5e\u6027\u5df2\u9884\u8bbe\u4e3a\u4e0e <code>HandlerLifetime<\/code> \u5339\u914d\uff08\u5982\u679c\u60a8\u591a\u6b21\u914d\u7f6e <code>HandlerLifetime<\/code>\uff0c\u5b83\u4f1a\u53cd\u6620\u6700\u65b0\u7684\u503c\uff09\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6b64\u66f4\u6539\u4ec5\u5f71\u54cd\u672a\u901a\u8fc7 <code>ConfigurePrimaryHttpMessageHandler&lt;T&gt;()<\/code> \u7b49\u65b9\u6cd5\u914d\u7f6e\u81ea\u5b9a\u4e49\u4e3b\u5904\u7406\u7a0b\u5e8f\u7684\u60c5\u51b5\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u867d\u7136\u4e3b\u5904\u7406\u7a0b\u5e8f\u7684\u9ed8\u8ba4\u5b9e\u73b0\u662f\u4e00\u4e2a\u5185\u90e8\u7ec6\u8282\uff0c\u5e76\u672a\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u660e\u786e\u89c4\u5b9a\uff0c\u4f46\u5b83\u4ecd\u7136\u88ab\u89c6\u4e3a\u4e00\u6b21<a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/networking\/9.0\/default-handler\">\u91cd\u5927\u53d8\u66f4<\/a>\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5f00\u53d1\u8005\u53ef\u80fd\u4f1a\u4f9d\u8d56\u7279\u5b9a\u7684\u5904\u7406\u7a0b\u5e8f\u7c7b\u578b\uff0c\u4f8b\u5982\u5c06\u4e3b\u5904\u7406\u7a0b\u5e8f\u8f6c\u6362\u4e3a <code>HttpClientHandler<\/code> \u4ee5\u8bbe\u7f6e <code>ClientCertificates<\/code>\u3001<code>UseCookies<\/code>\u3001<code>UseProxy<\/code> \u7b49\u5c5e\u6027\u3002\u5982\u679c\u9700\u8981\u4f7f\u7528\u8fd9\u4e9b\u5c5e\u6027\uff0c\u5efa\u8bae\u5728\u914d\u7f6e\u64cd\u4f5c\u4e2d\u540c\u65f6\u68c0\u67e5 <code>HttpClientHandler<\/code> \u548c <code>SocketsHttpHandler<\/code>\u3002\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.AddHttpClient(\"test\")\r\n    .ConfigurePrimaryHttpMessageHandler((h, _) =&gt;\r\n    {\r\n        if (h is HttpClientHandler hch)\r\n        {\r\n            hch.UseCookies = false;\r\n        }\r\n\r\n        if (h is SocketsHttpHandler shh)\r\n        {\r\n            shh.UseCookies = false;\r\n        }\r\n    });<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6216\u8005\uff0c\u60a8\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u5ba2\u6237\u7aef\u663e\u5f0f\u6307\u5b9a\u4e00\u4e2a\u4e3b\u5904\u7406\u7a0b\u5e8f\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.AddHttpClient(\"test\")\r\n    .ConfigurePrimaryHttpMessageHandler(() =&gt; new HttpClientHandler() { UseCookies = false });<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6216\u8005\uff0c\u4f7f\u7528 <code>ConfigureHttpClientDefaults<\/code> \u4e3a\u6240\u6709\u5ba2\u6237\u7aef\u914d\u7f6e\u9ed8\u8ba4\u7684 \u4e3b\u5904\u7406\u7a0b\u5e8f\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">services.ConfigureHttpClientDefaults(b =&gt;\r\n    b.ConfigurePrimaryHttpMessageHandler(() =&gt; new HttpClientHandler() { UseCookies = false }));<\/code><\/span><\/pre>\n<h2><span style=\"font-size: 18pt; font-family: tahoma, arial, helvetica, sans-serif;\"><span style=\"font-family: arial, helvetica, sans-serif;\"><b>\u5b89\u5168\u6027<\/b><\/span><\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 <code>System.Net.Security<\/code> \u4e2d\uff0c\u6211\u4eec\u5f15\u5165\u4e86\u5907\u53d7\u671f\u5f85\u7684 SSLKEYLOGFILE \u652f\u6301\u3001\u66f4\u591a\u652f\u6301 TLS \u4f1a\u8bdd\u6062\u590d\u7684\u573a\u666f\uff0c\u4ee5\u53ca\u534f\u5546 (Negotiate) API \u7684\u65b0\u529f\u80fd\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><span style=\"font-size: 14pt;\"><b>SSLKEYLOGFILE\u652f\u6301<\/b><\/span>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5b89\u5168\u9886\u57df\u4e2d\u88ab\u6295\u7968\u6700\u591a\u7684\u95ee\u9898\u662f\u652f\u6301\u8bb0\u5f55\u9884\u4e3b\u5bc6\u94a5\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/37915\">dotnet\/runtime#37915<\/a>\uff09\u3002\u8bb0\u5f55\u7684\u5bc6\u94a5\u53ef\u7528\u4e8e\u6570\u636e\u5305\u6355\u83b7\u5de5\u5177 Wireshark \u6765\u89e3\u5bc6\u6d41\u91cf\uff0c\u5728\u8c03\u67e5\u7f51\u7edc\u95ee\u9898\u65f6\u662f\u4e00\u4e2a\u6709\u7528\u7684\u8bca\u65ad\u5de5\u5177\u3002\u6b64\u5916\uff0cFirefox\uff08\u901a\u8fc7 <a href=\"https:\/\/udn.realityripple.com\/docs\/Mozilla\/Projects\/NSS\/Key_Log_Format\">NSS<\/a>\uff09\u3001Chrome \u4ee5\u53ca\u547d\u4ee4\u884c HTTP \u5de5\u5177\uff08\u5982 <a href=\"https:\/\/everything.curl.dev\/usingcurl\/tls\/sslkeylogfile\">cURL<\/a>\uff09\u4e5f\u63d0\u4f9b\u4e86\u76f8\u540c\u7684\u529f\u80fd\u3002\u6211\u4eec\u5df2\u5728 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.security.sslstream\">SslStream<\/a> \u548c <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.quic.quicconnection\">QuicConnection<\/a> \u4e2d\u5b9e\u73b0\u4e86\u8be5\u529f\u80fd\u3002\u5bf9\u4e8e SslStream\uff0c\u8be5\u529f\u80fd\u4ec5\u9650\u4e8e\u4f7f\u7528 OpenSSL \u4f5c\u4e3a\u52a0\u5bc6\u5e93\u7684\u5e73\u53f0\u3002\u4ece\u5b98\u65b9\u53d1\u5e03\u7684 .NET \u8fd0\u884c\u65f6\u7684\u89d2\u5ea6\u6765\u770b\uff0c\u8fd9\u610f\u5473\u7740\u5b83\u4ec5\u652f\u6301 Linux \u64cd\u4f5c\u7cfb\u7edf\u3002\u800c\u5bf9\u4e8e QuicConnection\uff0c\u5219\u65e0\u6b64\u9650\u5236\uff0c\u5e76\u4e14\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u53d7\u652f\u6301\u3002\u8fd9\u662f\u56e0\u4e3a TLS \u662f QUIC \u534f\u8bae\uff08<a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc9001.html\">RFC 9001<\/a>\uff09\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u7528\u6237\u6001 MsQuic \u53ef\u4ee5\u8bbf\u95ee\u6240\u6709\u5bc6\u94a5\uff0c.NET \u4e5f\u540c\u6837\u53ef\u4ee5\u3002<code>SslStream<\/code> \u5728 Windows \u4e0a\u7684\u9650\u5236\u6765\u81ea\u4e8e SChannel\uff0c\u5b83\u4f7f\u7528\u4e00\u4e2a\u72ec\u7acb\u7684\u7279\u6743\u8fdb\u7a0b\u6765\u5904\u7406 TLS\uff0c\u51fa\u4e8e\u5b89\u5168\u8003\u8651\uff0c\u8be5\u8fdb\u7a0b\u4e0d\u4f1a\u5141\u8bb8\u5bfc\u51fa\u5bc6\u94a5\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/94843\">dotnet\/runtime#94843<\/a>\uff09\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6b64\u529f\u80fd\u4f1a\u66b4\u9732\u5b89\u5168\u5bc6\u94a5\uff0c\u4ec5\u4f9d\u8d56\u73af\u5883\u53d8\u91cf\u53ef\u80fd\u4f1a\u5bfc\u81f4\u610f\u5916\u6cc4\u9732\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u51b3\u5b9a\u5f15\u5165\u4e00\u4e2a\u989d\u5916\u7684 <code>AppContext<\/code> \u5f00\u5173\u6765\u542f\u7528\u8be5\u529f\u80fd\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/100665\">dotnet\/runtime#100665<\/a>\uff09\u3002\u7528\u6237\u9700\u8981\u8bc1\u660e\u5bf9\u5e94\u7528\u7a0b\u5e8f\u7684\u6240\u6709\u6743\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5728\u4ee3\u7801\u4e2d\u4ee5\u7f16\u7a0b\u65b9\u5f0f\u8fdb\u884c\u8bbe\u7f6e\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">AppContext.SetSwitch(\"System.Net.EnableSslKeyLogging\", true);<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6216\u8005\u901a\u8fc7\u4fee\u6539\u5e94\u7528\u7a0b\u5e8f\u4e0b\u7684 <code>{appname}.runtimeconfig.json<\/code> \u6587\u4ef6\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">{\r\n  \"runtimeOptions\": {\r\n    \"configProperties\": {\r\n      \"System.Net.EnableSslKeyLogging\": true\r\n    }\r\n  }\r\n}<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u540e\u4e00\u6b65\u662f\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf <code>SSLKEYLOGFILE<\/code> \u5e76\u8fd0\u884c\u5e94\u7528\u7a0b\u5e8f\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">export SSLKEYLOGFILE=~\/keylogfile\r\n\r\n.\/&lt;appname&gt;<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6b64\u65f6\uff0c<code>~\/keylogfile<\/code> \u5c06\u5305\u542b\u53ef\u4ee5\u88ab Wireshark \u7528\u6765\u89e3\u5bc6\u6d41\u91cf\u7684\u9884\u4e3b\u5bc6\u94a5\u3002\u6709\u5173\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605 <a href=\"https:\/\/wiki.wireshark.org\/TLS#using-the-pre-master-secret\">TLS \u4f7f\u7528\uff08\u9884\uff09\u4e3b\u5bc6\u94a5<\/a>\u7684\u6587\u6863\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>\u4f7f\u7528\u5ba2\u6237\u7aef\u8bc1\u4e66\u6062\u590dTLS<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">TLS \u6062\u590d\u4f7f\u5f97\u80fd\u591f\u91cd\u7528\u4e4b\u524d\u5b58\u50a8\u7684 TLS \u6570\u636e\uff0c\u91cd\u65b0\u5efa\u7acb\u4e0e\u5148\u524d\u8fde\u63a5\u7684\u670d\u52a1\u5668\u7684\u8fde\u63a5\u3002\u5b83\u53ef\u4ee5\u8282\u7701\u63e1\u624b\u8fc7\u7a0b\u4e2d\u7684\u5f80\u8fd4\u65f6\u95f4\u4ee5\u53ca CPU \u5904\u7406\u3002\u6b64\u529f\u80fd\u662f Windows SChannel \u7684\u672c\u5730\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u5b83\u5728 Windows \u5e73\u53f0\u4e0a\u88ab .NET \u9690\u5f0f\u4f7f\u7528\u3002\u7136\u800c\uff0c\u5728 Linux \u5e73\u53f0\u4e0a\uff0c\u6211\u4eec\u4f7f\u7528 OpenSSL \u4f5c\u4e3a\u52a0\u5bc6\u5e93\uff0c\u542f\u7528 TLS \u6570\u636e\u7684\u7f13\u5b58\u548c\u91cd\u7528\u5219\u66f4\u4e3a\u590d\u6742\u3002\u6211\u4eec\u5728 .NET 7 \u4e2d\u9996\u6b21\u5f15\u5165\u4e86\u5bf9\u8be5\u529f\u80fd\u7684\u652f\u6301\uff08\u53c2\u89c1 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-7-networking-improvements\/#performance\">TLS Resume<\/a>\uff09\u3002\u5b83\u6709\u4e00\u4e9b\u9650\u5236\uff0c\u8fd9\u4e9b\u9650\u5236\u901a\u5e38\u5728 Windows \u4e0a\u662f\u4e0d\u5b58\u5728\u7684\u3002\u4e00\u4e2a\u9650\u5236\u662f\uff0c\u5b83\u4e0d\u652f\u6301\u4f7f\u7528\u5ba2\u6237\u7aef\u8bc1\u4e66\u8fdb\u884c\u7684\u53cc\u5411\u8eab\u4efd\u9a8c\u8bc1\u4f1a\u8bdd\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/94561\">dotnet\/runtime#94561<\/a>\uff09\u3002\u8fd9\u4e00\u95ee\u9898\u5df2\u7ecf\u5728 .NET 9 \u4e2d\u4fee\u590d\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/102656\">dotnet\/runtime#102656<\/a>\uff09\uff0c\u5e76\u4e14\u5728\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6\u65f6\u53ef\u4ee5\u6b63\u5e38\u5de5\u4f5c\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.security.sslclientauthenticationoptions.clientcertificatecontext\">ClientCertificateContext<\/a>\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.security.sslclientauthenticationoptions.localcertificateselectioncallback\">LocalCertificateSelectionCallback<\/a> \u5728\u7b2c\u4e00\u6b21\u8c03\u7528\u65f6\u8fd4\u56de\u975e\u7a7a\u8bc1\u4e66\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"6\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.security.sslclientauthenticationoptions.clientcertificates\">ClientCertificates<\/a> \u96c6\u5408\u4e2d\u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u5e26\u6709\u79c1\u94a5\u7684\u8bc1\u4e66\u00a0<\/span><\/li>\n<\/ul>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>Negotiate API \u5b8c\u6574\u6027\u68c0\u67e5<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728 .NET 7 \u4e2d\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.security.negotiateauthentication\">NegotiateAuthentication<\/a> API\uff0c\u53c2\u89c1 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-7-networking-improvements\/#negotiate-api\">Negotiate API<\/a>\u3002\u539f\u59cb\u5b9e\u73b0\u7684\u76ee\u6807\u662f\u901a\u8fc7\u53cd\u5c04\u79fb\u9664\u5bf9 <code>NTAuthentication<\/code> \u5185\u90e8\u7684\u8bbf\u95ee\u3002\u7136\u800c\uff0c\u8be5\u63d0\u6848\u7f3a\u5c11\u4ece <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc2743\">RFC 2743<\/a> \u751f\u6210\u548c\u9a8c\u8bc1\u6d88\u606f\u5b8c\u6574\u6027\u4ee3\u7801\u7684\u529f\u80fd\u3002\u8fd9\u4e9b\u901a\u5e38\u4f5c\u4e3a\u4f7f\u7528\u534f\u5546\u5bc6\u94a5\u7684\u52a0\u5bc6\u7b7e\u540d\u64cd\u4f5c\u6765\u5b9e\u73b0\u3002\u8be5 API \u7684\u63d0\u6848\u51fa\u73b0\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/86950\">dotnet\/runtime#86950<\/a> \u4e2d\uff0c\u5e76\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/96712\">dotnet\/runtime#96712<\/a> \u4e2d\u5b9e\u73b0\uff0c\u4e0e\u539f\u59cb\u66f4\u6539\u4e00\u6837\uff0cAPI \u63d0\u6848\u5230\u5b9e\u73b0\u7684\u6240\u6709\u5de5\u4f5c\u90fd\u7531\u793e\u533a\u8d21\u732e\u8005 <a href=\"https:\/\/github.com\/filipnavara\">@filipnavara<\/a> \u5b8c\u6210\u3002\u00a0<\/span><\/p>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u7f51\u7edc\u57fa\u7840\u7ec4\u4ef6<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u672c\u8282\u6db5\u76d6\u4e86 <code>System.Net<\/code> \u547d\u540d\u7a7a\u95f4\u4e2d\u7684\u66f4\u6539\u3002\u6211\u4eec\u5f15\u5165\u4e86\u5bf9\u670d\u52a1\u5668\u7aef\u4e8b\u4ef6\u7684\u65b0\u652f\u6301\u4ee5\u53ca\u4e00\u4e9b API \u7684\u5c0f\u6539\u52a8\uff0c\u4f8b\u5982\u65b0\u7684 MIME \u7c7b\u578b\u3002\u00a0<\/span><\/p>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>\u670d\u52a1\u5668\u53d1\u9001\u4e8b\u4ef6\u89e3\u6790\u5668<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u670d\u52a1\u5668\u53d1\u9001\u4e8b\u4ef6\u662f\u4e00\u79cd\u5141\u8bb8\u670d\u52a1\u5668\u901a\u8fc7 HTTP \u8fde\u63a5\u5c06\u6570\u636e\u66f4\u65b0\u63a8\u9001\u5230\u5ba2\u6237\u7aef\u7684\u6280\u672f\u3002\u5b83\u5728<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/server-sent-events.html\">\u73b0\u884c HTML \u6807\u51c6<\/a>\u4e2d\u5b9a\u4e49\uff0c\u4f7f\u7528 <code>text\/event-stream<\/code> MIME \u7c7b\u578b\uff0c\u5e76\u59cb\u7ec8\u4ee5 <code>UTF-8<\/code> \u89e3\u7801\u3002\u4e0e\u5ba2\u6237\u7aef\u62c9\u53d6\u76f8\u6bd4\uff0c\u670d\u52a1\u5668\u63a8\u9001\u65b9\u6cd5\u7684\u4f18\u52bf\u5728\u4e8e\u5b83\u53ef\u4ee5\u66f4\u597d\u5730\u5229\u7528\u7f51\u7edc\u8d44\u6e90\uff0c\u8fd8\u80fd\u8282\u7701\u79fb\u52a8\u8bbe\u5907\u7684\u7535\u6c60\u5bff\u547d\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5728\u672c\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u5f15\u5165\u4e86\u4e00\u4e2a OOB \u5305 <code>System.Net.ServerSentEvents<\/code>\u3002\u5b83\u4f5c\u4e3a .NET Standard 2.0 \u7684 <a href=\"https:\/\/www.nuget.org\/packages\/System.Net.ServerSentEvents\">NuGet \u5305<\/a>\u63d0\u4f9b\u3002\u8be5\u5305\u63d0\u4f9b\u4e86\u4e00\u4e2a\u670d\u52a1\u5668\u53d1\u9001\u4e8b\u4ef6\u6d41\u7684\u89e3\u6790\u5668\uff0c\u9075\u5faa\u8be5<a href=\"https:\/\/html.spec.whatwg.org\/multipage\/server-sent-events.html#parsing-an-event-stream\">\u89c4\u8303<\/a>\u3002\u8be5\u534f\u8bae\u662f\u57fa\u4e8e\u6d41\u7684\uff0c\u5355\u4e2a\u9879\u4e4b\u95f4\u901a\u8fc7\u7a7a\u884c\u5206\u9694\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6bcf\u4e2a\u9879\u6709\u4e24\u4e2a\u5b57\u6bb5\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>type<\/code> \u2013 \u9ed8\u8ba4\u7c7b\u578b\u662f <code>message\u00a0<\/code><\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"5\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>data<\/code> \u2013 \u6570\u636e\u672c\u8eab\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u6709\u4e24\u4e2a\u5176\u4ed6\u53ef\u9009\u5b57\u6bb5\uff0c\u7528\u4e8e\u9010\u6b65\u66f4\u65b0\u6d41\u7684\u5c5e\u6027\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>id<\/code> \u2013 \u786e\u5b9a\u5728\u9700\u8981\u91cd\u65b0\u8fde\u63a5\u65f6\uff0c\u4f5c\u4e3a <a href=\"https:\/\/html.spec.whatwg.org\/multipage\/server-sent-events.html#the-last-event-id-header\">Last-Event-Id \u6807\u5934<\/a>\u53d1\u9001\u7684\u6700\u540e\u4e8b\u4ef6 ID\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><code>retry<\/code> \u2013 \u91cd\u65b0\u8fde\u63a5\u5c1d\u8bd5\u4e4b\u95f4\u7b49\u5f85\u7684\u6beb\u79d2\u6570\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8be5\u5e93\u7684 API \u63d0\u6848\u51fa\u73b0\u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/98105\">dotnet\/runtime#98105<\/a>\uff0c\u5e76\u5305\u542b\u89e3\u6790\u5668\u548c\u9879\u7684\u7c7b\u578b\u5b9a\u4e49\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.serversentevents.sseparser\">SseParser<\/a> \u2013 \u9759\u6001\u7c7b\uff0c\u7528\u4e8e\u4ece\u6d41\u521b\u5efa\u5b9e\u9645\u7684\u89e3\u6790\u5668\uff0c\u5141\u8bb8\u7528\u6237\u53ef\u9009\u5730\u4e3a\u9879\u6570\u636e\u63d0\u4f9b\u89e3\u6790\u59d4\u6258\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.serversentevents.sseparser-1\">SseParser&lt;T&gt;<\/a> \u2013 \u89e3\u6790\u5668\u672c\u8eab\uff0c\u63d0\u4f9b\u540c\u6b65\u6216\u5f02\u6b65\u679a\u4e3e\u6d41\u5e76\u8fd4\u56de\u89e3\u6790\u540e\u7684\u9879\u7684\u65b9\u6cd5\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.serversentevents.sseitem-1\">SseItem&lt;T&gt;<\/a> \u2013 \u7ed3\u6784\u4f53\uff0c\u5305\u542b\u89e3\u6790\u540e\u7684\u9879\u6570\u636e\u00a0<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u7136\u540e\uff0c\u89e3\u6790\u5668\u53ef\u4ee5\u50cf\u8fd9\u6837\u4f7f\u7528\uff0c\u4f8b\u5982\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">using HttpClient client = new HttpClient();\r\nusing Stream stream = await client.GetStreamAsync(\"https:\/\/server\/sse\");\r\n\r\nvar parser = SseParser.Create(stream, (type, data) =&gt;\r\n{\r\n    var str = Encoding.UTF8.GetString(data);\r\n    return Int32.Parse(str);\r\n});\r\nawait foreach (var item in parser.EnumerateAsync())\r\n{\r\n    Console.WriteLine($\"{item.EventType}: {item.Data} [{parser.LastEventId};{parser.ReconnectionInterval}]\");\r\n}<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u548c\u4ee5\u4e0b\u8f93\u5165\uff1a\u00a0<\/span><\/p>\n<pre class=\"prettyprint language-default\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif;\"><code class=\"language-default\">: stream of integers\r\n\r\ndata: 123\r\nid: 1\r\nretry: 1000\r\n\r\ndata: 456\r\nid: 2\r\n\r\ndata: 789\r\nid: 3<\/code><\/span><\/pre>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8f93\u51fa\uff1a<\/span><\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">message: 123 [1;00:00:01]\r\nmessage: 456 [2;00:00:01]\r\nmessage: 789 [3;00:00:01]<\/code><\/pre>\n<h3><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 14pt;\"><b>\u57fa\u7840\u7ec4\u4ef6\u6269\u5c55<\/b>\u00a0<\/span><\/h3>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u9664\u4e86\u670d\u52a1\u5668\u53d1\u9001\u4e8b\u4ef6\uff0c<code>System.Net<\/code> \u547d\u540d\u7a7a\u95f4\u8fd8\u65b0\u589e\u4e86\u4e00\u4e9b\u5c0f\u7684\u529f\u80fd\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/97940\">dotnet\/runtime#97940<\/a> \u4e2d <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.uri.equals#system-uri-equals%28system-uri%29\">Uri<\/a> \u7684 <code>IEquatable&lt;Uri&gt;<\/code> \u63a5\u53e3\u5b9e\u73b0\u00a0<\/span>\n<span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u5141\u8bb8\u5728\u9700\u8981 <code>IEquatable<\/code> \u7684\u51fd\u6570\u4e2d\u4f7f\u7528 <code>Uri<\/code>\uff0c\u4f8b\u5982 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.memoryextensions.contains#system-memoryextensions-contains-1%28system-readonlyspan%28%28-0%29%29-0%29\">Span.Contains<\/a> \u6216 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.memoryextensions.sequenceequal#system-memoryextensions-sequenceequal-1%28system-readonlyspan%28%28-0%29%29-system-readonlyspan%28%28-0%29%29%29\">SequenceEquals<\/a>\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u57fa\u4e8e span \u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.uri.escapedatastring#system-uri-escapedatastring%28system-readonlyspan%28%28system-char%29%29%29\">(Try)EscapeDataString<\/a> \u548c <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.uri.unescapedatastring#system-uri-unescapedatastring%28system-readonlyspan%28%28system-char%29%29%29\">(Try)UnescapeDataString<\/a> \u7528\u4e8e <code>Uri<\/code>\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/40603\">dotnet\/runtime#40603<\/a>\uff09\u00a0<\/span>\n<span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u76ee\u6807\u662f\u652f\u6301\u4f4e\u5206\u914d\u573a\u666f\uff0c\u73b0\u5728\u6211\u4eec\u5728 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.http.formurlencodedcontent\">FormUrlEncodedContent<\/a> \u4e2d\u5229\u7528\u4e86\u8fd9\u4e9b\u65b9\u6cd5\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"2\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u65b0\u7684 MIME \u7c7b\u578b\u7528\u4e8e <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.net.mime.mediatypenames\">MediaTypeNames<\/a>\uff08<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\/95446\">dotnet\/runtime#95446<\/a>\uff09\u00a0<\/span>\n<span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u8fd9\u4e9b\u7c7b\u578b\u662f\u5728\u53d1\u5e03\u8fc7\u7a0b\u4e2d\u6536\u96c6\u7684\uff0c\u5e76\u7531\u793e\u533a\u8d21\u732e\u8005 <a href=\"https:\/\/github.com\/CollinAlpert\">@CollinAlpert<\/a> \u5728 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pull\/103575\">dotnet\/runtime#103575<\/a> \u4e2d\u5b9e\u73b0\u3002\u00a0<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 18pt;\"><b>\u6700\u7ec8\u8bf4\u660e<\/b>\u00a0<\/span><\/h2>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u548c\u5f80\u5e74\u4e00\u6837\uff0c\u6211\u4eec\u5c3d\u529b\u5199\u4e0b\u7f51\u7edc\u9886\u57df\u4e2d\u6709\u8da3\u4e14\u6709\u5f71\u54cd\u529b\u7684\u53d8\u5316\u3002\u672c\u6587\u4e0d\u53ef\u80fd\u6db5\u76d6\u6240\u6709\u505a\u51fa\u7684\u66f4\u6539\u3002\u5982\u679c\u60a8\u611f\u5174\u8da3\uff0c\u53ef\u4ee5\u5728\u6211\u4eec\u7684 <a href=\"https:\/\/github.com\/dotnet\/runtime\/pulls?q=is%3Apr+is%3Aclosed+is%3Amerged+milestone%3A9.0.0+label%3Aarea-System.Net%2Carea-System.Net.Http%2Carea-System.Net.Sockets%2Carea-System.Net.Security+-label%3Atest-enhancement%2Ctest-bug%2Cdisabled-test\">dotnet\/runtime<\/a> \u4ed3\u5e93\u4e2d\u627e\u5230\u5b8c\u6574\u7684\u6539\u52a8\u5217\u8868\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5728\u90a3\u513f\u5411\u6211\u4eec\u63d0\u51fa\u95ee\u9898\u548c\u62a5\u544a bug\u3002\u6b64\u5916\uff0c\u8bb8\u591a\u672a\u5728\u6b64\u63d0\u53ca\u7684\u6027\u80fd\u4f18\u5316\uff0c\u53ef\u4ee5\u5728 Stephen \u7684\u7cbe\u5f69\u6587\u7ae0\u300a<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/performance-improvements-in-net-9\/#networking\">.NET 9 \u4e2d\u7684\u6027\u80fd\u4f18\u5316<\/a>\u300b\u4e2d\u627e\u5230\u3002\u6211\u4eec\u4e5f\u5f88\u60f3\u542c\u5230\u60a8\u7684\u58f0\u97f3\uff0c\u5982\u679c\u60a8\u9047\u5230\u95ee\u9898\u6216\u6709\u4efb\u4f55\u53cd\u9988\uff0c\u53ef\u4ee5\u5728<a href=\"https:\/\/github.com\/dotnet\/runtime\/issues\">\u6211\u4eec\u7684 GitHub \u4ed3\u5e93<\/a>\u4e2d\u63d0\u4ea4\u3002\u00a0<\/span><\/p>\n<p><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\">\u6700\u540e\uff0c\u6211\u8981\u611f\u8c22\u6211\u7684\u5171\u540c\u4f5c\u8005\uff1a\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/github.com\/antonfirsov\">@antonfirsov<\/a> \u7f16\u5199\u4e86<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#diagnostics\">\u8bca\u65ad\u76f8\u5173\u5185\u5bb9<\/a>\u3002\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"1\" data-list-defn-props=\"{&quot;335552541&quot;:1,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769226&quot;:&quot;Symbol&quot;,&quot;469769242&quot;:[8226],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;\uf0b7&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span style=\"font-family: tahoma, arial, helvetica, sans-serif; font-size: 12pt;\"><a href=\"https:\/\/github.com\/CarnaViire\">@CarnaViire<\/a> \u7f16\u5199\u4e86 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#httpclientfactory\">HttpClientFactory<\/a> \u548c <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-9-networking-improvements\/#websockets\">WebSockets<\/a> \u76f8\u5173\u5185\u5bb9\u3002\u00a0<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea M\u00e1\u0148a, Natalia \u548c Anton \u521b\u4f5c\u7684 .NET 9 Networking Improvements \u79c9\u627f\u6211\u4eec\u7684\u4f20\u7edf\uff0c\u6211\u4eec\u5f88\u9ad8\u5174\u4e0e\u60a8\u5206\u4eab\u8fd9\u7bc7\u535a\u5ba2\u6587\u7ae0\uff0c\u4ee5\u4ecb\u7ecd\u65b0\u7684 .NET \u7248\u672c\u4e2d\u7f51\u7edc\u9886\u57df\u76f8\u5173\u7684\u6700\u65b0\u52a8\u6001\u548c\u6700\u6709\u8da3\u7684\u53d8\u5316\u3002\u4eca\u5e74\uff0c\u6211\u4eec\u5e26\u6765\u4e86 HTTP \u9886\u57df\u7684\u6539\u53d8\u3001\u65b0\u7684 HttpClientFactory API\u3001.NET Framework \u517c\u5bb9\u6027\u4f18\u5316\u7b49\u66f4\u591a\u5185\u5bb9\u3002\u00a0 HTTP \u5728\u63a5\u4e0b\u6765\u7684\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd HTTP \u9886\u57df\u6700\u5177\u5f71\u54cd\u529b\u7684\u53d8\u5316\u3002\u5176\u4e2d\u5305\u62ec\u8fde\u63a5\u6c60\u7684\u6027\u80fd\u4f18\u5316\u3001\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u652f\u6301\u3001Windows\u4ee3\u7406\u7684\u81ea\u52a8\u66f4\u65b0\uff0c\u4ee5\u53ca\u91cd\u8981\u7684\u793e\u533a\u8d21\u732e\u3002\u00a0 \u8fde\u63a5\u6c60 \u5728\u6b64\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u5bf9HTTP\u8fde\u63a5\u6c60\u8fdb\u884c\u4e86\u4e24\u9879\u663e\u8457\u7684\u6027\u80fd\u4f18\u5316\u3002\u00a0 \u6211\u4eec\u589e\u52a0\u4e86\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u53ef\u9009\u652f\u6301\u3002\u6839\u636eRFC 9114\u6807\u51c6\u6587\u6863\uff0c\u7531\u4e8e\u8fde\u63a5\u53ef\u4ee5\u591a\u8def\u590d\u7528\u5e76\u884c\u8bf7\u6c42\uff0c\u56e0\u6b64\u4e0d\u9f13\u52b1\u4f7f\u7528\u591a\u4e2aHTTP\/3\u8fde\u63a5\u5230\u5bf9\u7b49\u7aef\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u4f8b\u5982\u670d\u52a1\u5668\u5230\u670d\u52a1\u5668\u7684\u901a\u4fe1\uff0c\u5373\u4f7f\u8bf7\u6c42\u591a\u8def\u590d\u7528\uff0c\u5355\u4e00\u8fde\u63a5\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u6211\u4eec\u5728 HTTP\/2 \u4e2d\u770b\u5230\u4e86\u8fd9\u6837\u7684\u9650\u5236\uff08dotnet\/runtime#35088\uff09\uff0c\u5b83\u540c\u6837\u5177\u6709\u5728\u5355\u4e00\u8fde\u63a5\u4e0a\u591a\u8def\u590d\u7528\u7684\u6982\u5ff5\u3002\u51fa\u4e8e\u540c\u6837\u7684\u539f\u56e0\uff08dotnet\/runtime#51775\uff09\uff0c\u6211\u4eec\u51b3\u5b9a\u4e3aHTTP\/3\u5b9e\u73b0\u591a\u8fde\u63a5\u652f\u6301\uff08dotnet\/runtime#101535\uff09\u3002\u00a0 \u8be5\u5b9e\u73b0\u672c\u8eab\u5c3d\u53ef\u80fd\u8d34\u8fd1 HTTP\/2 \u591a\u8fde\u63a5\u673a\u5236\u7684\u884c\u4e3a\u3002\u5f53\u524d\uff0c\u5b83\u7684\u7b56\u7565\u662f\u4f18\u5148\u586b\u5145\u5df2\u6709\u8fde\u63a5\uff0c\u76f4\u5230\u8fbe\u5230\u5bf9\u7aef\u5141\u8bb8\u7684\u8bf7\u6c42\u4e0a\u9650\u540e\uff0c\u624d\u4f1a\u521b\u5efa\u65b0\u7684\u8fde\u63a5\u3002\u4e0d\u8fc7\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u8be5\u884c\u4e3a\u5728\u672a\u6765\u53ef\u80fd\u4f1a\u6709\u6240\u53d8\u5316\u3002\u00a0 \u7ed3\u679c\u662f\uff0c\u6211\u4eec\u7684\u57fa\u51c6\u6d4b\u8bd5\u663e\u793a\u6bcf\u79d2\u8bf7\u6c42\u6570\uff08RPS\uff09\u6709\u663e\u8457\u63d0\u5347\uff0c\u4ee5\u4e0b\u662f10,000\u4e2a\u5e76\u884c\u8bf7\u6c42\u7684\u5bf9\u6bd4\u7ed3\u679c\uff1a\u00a0 \u5ba2\u6237\u7aef\u00a0 \u5355 HTTP\/3 \u8fde\u63a5\u00a0 \u591a HTTP\/3 \u8fde\u63a5\u00a0 \u6700\u5927CPU\u4f7f\u7528\u7387(%)\u00a0 35\u00a0 92\u00a0 \u6700\u5927\u6838\u5fc3\u4f7f\u7528\u7387(%)\u00a0 971\u00a0 2572\u00a0 \u6700\u5927\u5de5\u4f5c\u96c6(MB)\u00a0 3810\u00a0 6491\u00a0 \u6700\u5927\u79c1\u6709\u5185\u5b58(MB)\u00a0 4415\u00a0 7228\u00a0 \u5904\u7406\u5668\u6570\u91cf\u00a0 28\u00a0 28\u00a0 [&hellip;]<\/p>\n","protected":false},"author":177361,"featured_media":1027,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[59,1,78],"tags":[52,26,79,80],"class_list":["post-1008","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-net","category-dotnet-ch","category-networking","tag-net-9","tag-http","tag-http-client-factory","tag-net-security"],"acf":[],"blog_post_summary":"<p>\u672c\u6587\u7ffb\u8bd1\u81ea M\u00e1\u0148a, Natalia \u548c Anton \u521b\u4f5c\u7684 .NET 9 Networking Improvements \u79c9\u627f\u6211\u4eec\u7684\u4f20\u7edf\uff0c\u6211\u4eec\u5f88\u9ad8\u5174\u4e0e\u60a8\u5206\u4eab\u8fd9\u7bc7\u535a\u5ba2\u6587\u7ae0\uff0c\u4ee5\u4ecb\u7ecd\u65b0\u7684 .NET \u7248\u672c\u4e2d\u7f51\u7edc\u9886\u57df\u76f8\u5173\u7684\u6700\u65b0\u52a8\u6001\u548c\u6700\u6709\u8da3\u7684\u53d8\u5316\u3002\u4eca\u5e74\uff0c\u6211\u4eec\u5e26\u6765\u4e86 HTTP \u9886\u57df\u7684\u6539\u53d8\u3001\u65b0\u7684 HttpClientFactory API\u3001.NET Framework \u517c\u5bb9\u6027\u4f18\u5316\u7b49\u66f4\u591a\u5185\u5bb9\u3002\u00a0 HTTP \u5728\u63a5\u4e0b\u6765\u7684\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd HTTP \u9886\u57df\u6700\u5177\u5f71\u54cd\u529b\u7684\u53d8\u5316\u3002\u5176\u4e2d\u5305\u62ec\u8fde\u63a5\u6c60\u7684\u6027\u80fd\u4f18\u5316\u3001\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u652f\u6301\u3001Windows\u4ee3\u7406\u7684\u81ea\u52a8\u66f4\u65b0\uff0c\u4ee5\u53ca\u91cd\u8981\u7684\u793e\u533a\u8d21\u732e\u3002\u00a0 \u8fde\u63a5\u6c60 \u5728\u6b64\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u5bf9HTTP\u8fde\u63a5\u6c60\u8fdb\u884c\u4e86\u4e24\u9879\u663e\u8457\u7684\u6027\u80fd\u4f18\u5316\u3002\u00a0 \u6211\u4eec\u589e\u52a0\u4e86\u5bf9\u591a\u4e2aHTTP\/3\u8fde\u63a5\u7684\u53ef\u9009\u652f\u6301\u3002\u6839\u636eRFC 9114\u6807\u51c6\u6587\u6863\uff0c\u7531\u4e8e\u8fde\u63a5\u53ef\u4ee5\u591a\u8def\u590d\u7528\u5e76\u884c\u8bf7\u6c42\uff0c\u56e0\u6b64\u4e0d\u9f13\u52b1\u4f7f\u7528\u591a\u4e2aHTTP\/3\u8fde\u63a5\u5230\u5bf9\u7b49\u7aef\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u4f8b\u5982\u670d\u52a1\u5668\u5230\u670d\u52a1\u5668\u7684\u901a\u4fe1\uff0c\u5373\u4f7f\u8bf7\u6c42\u591a\u8def\u590d\u7528\uff0c\u5355\u4e00\u8fde\u63a5\u4e5f\u53ef\u80fd\u6210\u4e3a\u74f6\u9888\u3002\u6211\u4eec\u5728 HTTP\/2 \u4e2d\u770b\u5230\u4e86\u8fd9\u6837\u7684\u9650\u5236\uff08dotnet\/runtime#35088\uff09\uff0c\u5b83\u540c\u6837\u5177\u6709\u5728\u5355\u4e00\u8fde\u63a5\u4e0a\u591a\u8def\u590d\u7528\u7684\u6982\u5ff5\u3002\u51fa\u4e8e\u540c\u6837\u7684\u539f\u56e0\uff08dotnet\/runtime#51775\uff09\uff0c\u6211\u4eec\u51b3\u5b9a\u4e3aHTTP\/3\u5b9e\u73b0\u591a\u8fde\u63a5\u652f\u6301\uff08dotnet\/runtime#101535\uff09\u3002\u00a0 \u8be5\u5b9e\u73b0\u672c\u8eab\u5c3d\u53ef\u80fd\u8d34\u8fd1 HTTP\/2 \u591a\u8fde\u63a5\u673a\u5236\u7684\u884c\u4e3a\u3002\u5f53\u524d\uff0c\u5b83\u7684\u7b56\u7565\u662f\u4f18\u5148\u586b\u5145\u5df2\u6709\u8fde\u63a5\uff0c\u76f4\u5230\u8fbe\u5230\u5bf9\u7aef\u5141\u8bb8\u7684\u8bf7\u6c42\u4e0a\u9650\u540e\uff0c\u624d\u4f1a\u521b\u5efa\u65b0\u7684\u8fde\u63a5\u3002\u4e0d\u8fc7\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u8fd9\u662f\u4e00\u4e2a\u5177\u4f53\u7684\u5b9e\u73b0\u7ec6\u8282\uff0c\u8be5\u884c\u4e3a\u5728\u672a\u6765\u53ef\u80fd\u4f1a\u6709\u6240\u53d8\u5316\u3002\u00a0 \u7ed3\u679c\u662f\uff0c\u6211\u4eec\u7684\u57fa\u51c6\u6d4b\u8bd5\u663e\u793a\u6bcf\u79d2\u8bf7\u6c42\u6570\uff08RPS\uff09\u6709\u663e\u8457\u63d0\u5347\uff0c\u4ee5\u4e0b\u662f10,000\u4e2a\u5e76\u884c\u8bf7\u6c42\u7684\u5bf9\u6bd4\u7ed3\u679c\uff1a\u00a0 \u5ba2\u6237\u7aef\u00a0 \u5355 HTTP\/3 \u8fde\u63a5\u00a0 \u591a HTTP\/3 \u8fde\u63a5\u00a0 \u6700\u5927CPU\u4f7f\u7528\u7387(%)\u00a0 35\u00a0 92\u00a0 \u6700\u5927\u6838\u5fc3\u4f7f\u7528\u7387(%)\u00a0 971\u00a0 2572\u00a0 \u6700\u5927\u5de5\u4f5c\u96c6(MB)\u00a0 3810\u00a0 6491\u00a0 \u6700\u5927\u79c1\u6709\u5185\u5b58(MB)\u00a0 4415\u00a0 7228\u00a0 \u5904\u7406\u5668\u6570\u91cf\u00a0 28\u00a0 28\u00a0 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1008","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/users\/177361"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/comments?post=1008"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/1008\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media\/1027"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media?parent=1008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/categories?post=1008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/tags?post=1008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}