{"id":425810,"date":"2021-03-31T05:49:04","date_gmt":"2021-03-30T21:49:04","guid":{"rendered":"http:\/\/4563.org\/?p=425810"},"modified":"2021-03-31T05:49:04","modified_gmt":"2021-03-30T21:49:04","slug":"wsl-%e9%87%8c%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%90%af%e5%8a%a8%e5%90%8e%e7%aa%81%e7%84%b6%e8%ae%bf%e9%97%ae%e4%b8%8d%e4%ba%86-%e5%8f%af%e8%83%bd%e6%98%af%e4%bb%80%e4%b9%88%e5%8e%9f%e5%9b%a0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=425810","title":{"rendered":"WSL \u91cc\u7684\u670d\u52a1\u542f\u52a8\u540e\u7a81\u7136\u8bbf\u95ee\u4e0d\u4e86 \u53ef\u80fd\u662f\u4ec0\u4e48\u539f\u56e0"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  WSL \u91cc\u7684\u670d\u52a1\u542f\u52a8\u540e\u7a81\u7136\u8bbf\u95ee\u4e0d\u4e86 \u53ef\u80fd\u662f\u4ec0\u4e48\u539f\u56e0               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <span><i><\/i> 6<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5f88\u5947\u602a\u7684\u95ee\u9898\u3002\u3002\u3002\u6628\u5929\u665a\u4e0a\u8fd8\u80fd\u7528\uff0c\u4eca\u5929\u8d77\u6765\u542f\u52a8\u5c31\u6253\u4e0d\u5f00\u4e86<\/p>\n<p>\u540e\u7aef\u662f dotnet \u524d\u7aef\u662f angular\uff0c\u90fd\u8dd1\u5728 WSL2 \u91cc<\/p>\n<p>\u542f\u52a8\u4e00\u5207\u6b63\u5e38\uff0c\u6ca1\u6709\u62a5\u9519<\/p>\n<p>\u540e\u7aef\u63a5\u53e3 localhost:5001 \u53ef\u4ee5\u8bbf\u95ee<\/p>\n<p>\u524d\u7aef\u9875\u9762 localhost:4200 \u5c31\u4e00\u76f4\u8bbf\u95ee\u4e0d\u4e86\u3002\u3002\u3002<\/p>\n<pre><code>\u65e0\u6cd5\u8bbf\u95ee\u6b64\u7f51\u7ad9 localhost \u62d2\u7edd\u4e86\u6211\u4eec\u7684\u8fde\u63a5\u8bf7\u6c42\u3002 \u8bf7\u8bd5\u8bd5\u4ee5\u4e0b\u529e\u6cd5\uff1a  \u68c0\u67e5\u7f51\u7edc\u8fde\u63a5 \u68c0\u67e5\u4ee3\u7406\u670d\u52a1\u5668\u548c\u9632\u706b\u5899 ERR_CONNECTION_REFUSED <\/code><\/pre>\n<p>\u8fd9\u96be\u9053\u662f\u7f51\u7edc\u7684\u95ee\u9898\u5417\uff1f<\/p>\n<p>\u53c8\u8bd5\u4e86\u4e00\u4e0b\uff0c\u6539\u6210\u5176\u4ed6\u7aef\u53e3\u5c31\u53ef\u4ee5\u4e86<\/p>\n<p>\u90a3\u53c8\u662f\u4e3a\u5565\u5462\uff1f \u6211\u7684 4200 \u7aef\u53e3\u53d1\u751f\u4e86\u795e\u9b54\u4e8b\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5708725\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : learningman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u80fd\u5916\u9762\u7684 4200 \u88ab\u5360\u7528\u4e86\uff0c\u4f46\u662f\u865a\u62df\u673a\u91cc\u6ca1\u6709<br \/>\u6240\u4ee5 listen \u4f1a\u6210\u529f\uff0c\u6620\u5c04\u4f1a\u5931\u8d25\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708726\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @learningman \u68c0\u67e5\u4e86\u4e00\u4e0b \u4e0d\u662f\u8fd9\u4e2a\u539f\u56e0                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708727\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ch2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             WSL2 \u6709\u81ea\u5df1\u7684 ip\uff0c\u4f60 ifconfig \u4e00\u4e0b\u5c31\u77e5\u9053\u4e86\uff0c\u6240\u8c13 Localhost \u80fd\u8bbf\u95ee\u662f hyper-v \u505a\u4e86\u8f6c\u53d1\uff0c\u4f46\u662f\u8fd9\u4e2a\u8f6c\u53d1\u53ef\u80fd\u56e0\u4e3a\u5404\u79cd\u539f\u56e0\u4f1a\u5931\u8d25\uff0c\u4f60\u8981 debug \u9700\u8981\u4ece\u8fd9\u51e0\u4e2a\u5730\u65b9\u5165\u624b:<br \/>1\uff0c\u5728 WSL2 \u4e2d\u8bbf\u95ee\u4f60\u7684 docker \u670d\u52a1<br \/>2\uff0c\u5728 Windows \u4e2d\u4f7f\u7528 172.x.x.x \u90a3\u4e2a WSL2 \u7684 ip \u8bbf\u95ee\u670d\u52a1<br \/>3\uff0c\u5728 Windows \u4e2d\u4f7f\u7528 localhost \u8bbf\u95ee\u8be5\u670d\u52a1(\u4e0d\u8981\u7528 127.0.0.1\uff0c\u90a3\u4e2a\u662f Windows \u81ea\u5df1\u7684\u73af\u56de\u7f51\u7edc)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708728\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ch2 <\/p>\n<p>1\uff0c\u6ca1\u7528 docker<br \/>2\uff0c172.x.x.x \u4e5f\u8bbf\u95ee\u4e0d\u4e86\u3002\u3002\u3002<br \/>3\uff0cwindows \u4e0b\u7528 localhost \u8bbf\u95ee\u4e0d\u4e86<\/p>\n<p>\u8bd5\u4e86\u51e0\u4e2a\u7aef\u53e3 \u53d1\u73b0 4100 \u53ef\u4ee5\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684 4200 \u4ee5\u53ca\u6539\u7684\u5176\u4ed6\u7aef\u53e3\u90fd\u4e0d\u884c\u3002\u3002\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708729\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zxCoder <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ch2 <br \/>@learningman <\/p>\n<p>\u6700\u540e\u8fd8\u662f\u7528\u4e07\u80fd\u91cd\u542f\u5927\u6cd5\u89e3\u51b3\u4e86\u3002\u3002\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708730\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : frankyzf <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e4b\u524d windows 10 \u9047\u5230\u4e00\u79cd\u60c5\u51b5\u662f Hyper-v \u4f1a\u4fdd\u7559\u4e00\u4e9b\u7aef\u53e3\uff0c\u4e0d\u77e5\u9053\u548c\u4f60\u7684\u60c5\u51b5\u662f\u4e0d\u662f\u4e00\u6837\u3002\u53ef\u4ee5\u8bd5\u8bd5<br \/>net stop winnat<br \/>net start winnat<br \/>work \u5417\uff0c\u5982\u679c\u53ef\u4ee5\u7684\u8bdd\u5c31\u53c2\u8003 https:\/\/www.v2ex.com\/t\/762894 \u4e2d\u7684\u56de\u590d\u8bbe\u7f6e\u4e00\u4e0b\u7aef\u53e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708731\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : learningman <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ch2 localhost \u5c31\u662f 127.0.0.1 \u3002\u3002\u3002hosts \u6587\u4ef6\u6307\u5b9a\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708732\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xio <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u91cd\u542f\u4e00\u4e0b\u7535\u8111\u5c31\u597d\u4e86\uff0c\u8fd9\u4e2a\u95ee\u9898\u5f88\u4e45\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5708733\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wty <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u7528 jekyll \u7684\u65f6\u5019\u7ecf\u5e38\u9047\u5230\u8fdb\u7a0b\u5d29\u6e83\uff0c\u7ed3\u675f\u4e0d\u6389\uff0c\u4e00\u76f4\u5360\u7528\uff0c\u53ea\u80fd\u91cd\u542f\u89e3\u51b3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>WSL \u91cc\u7684\u670d\u52a1\u542f\u52a8\u540e\u7a81\u7136\u8bbf\u95ee\u4e0d\u4e86&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/425810"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=425810"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/425810\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=425810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=425810"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=425810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}