{"id":315596,"date":"2024-05-21T00:04:53","date_gmt":"2024-05-20T16:04:53","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/315596.html"},"modified":"2024-05-21T00:05:14","modified_gmt":"2024-05-20T16:05:14","slug":"github-%e4%b8%8a%e6%9c%89%e5%93%aa%e4%ba%9b%e4%b8%8d%e9%94%99%e7%9a%84-net-mvc-%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/315596.html","title":{"rendered":"GitHub \u4e0a\u6709\u54ea\u4e9b\u4e0d\u9519\u7684 .NET MVC \u6846\u67b6"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27035427\/c5301ba5-7585-404e-829e-63ec629e8188.webp\" alt=\"GitHub \u4e0a\u6709\u54ea\u4e9b\u4e0d\u9519\u7684 .NET MVC \u6846\u67b6\" \/><\/p>\n<p><p>GitHub\u4e0a\u62e5\u6709\u4f17\u591a\u51fa\u8272\u7684.NET MVC\u6846\u67b6\uff0c<strong>\u4e3b\u8981\u5305\u62ecASP.NET MVC\u3001NancyFX\u3001MonoR<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>l\u7b49<\/strong>\u3002\u8fd9\u4e9b\u6846\u67b6\u5404\u5177\u7279\u8272\uff0c\u4e3a.NET\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u5de5\u5177\u548c\u5e93\u4ee5\u6784\u5efa\u9ad8\u6548\u3001\u53ef\u6269\u5c55\u7684\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><p>\u5176\u4e2d\uff0c<strong>ASP.NET MVC<\/strong>\u662f\u7531Microsoft\u5f00\u53d1\u7684\u4e00\u4e2a\u514d\u8d39\u7684\u5f00\u6e90\u7f51\u9875\u5e94\u7528\u6846\u67b6\u3002\u5b83\u5b9e\u73b0\u4e86MVC\uff08\u6a21\u578b-\u89c6\u56fe-\u63a7\u5236\u5668\uff09\u6a21\u5f0f\uff0c\u4f7f\u5f97\u5e94\u7528\u7a0b\u5e8f\u7684\u5f00\u53d1\u3001\u6d4b\u8bd5\u548c\u7ef4\u62a4\u53d8\u5f97\u66f4\u52a0\u7b80\u5355\u548c\u5feb\u901f\u3002ASP.NET MVC\u6846\u67b6\u652f\u6301\u4f7f\u7528Razor\u89c6\u56fe\u5f15\u64ce\u6765\u521b\u5efa\u52a8\u6001\u7f51\u9875\u3002\u6b64\u5916\uff0c\u5b83\u8fd8\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u7279\u6027\uff0c\u5305\u62ec\u5f3a\u5927\u7684URL\u8def\u7531\u3001\u89c6\u56fe\u5e03\u5c40\u3001\u6346\u7ed1\u548c\u6700\u5c0f\u5316\u7b49\uff0c\u8fd9\u4e9b\u7279\u6027\u4f7f\u5f97\u5f00\u53d1\u4eba\u5458\u80fd\u591f\u6784\u5efa\u9ad8\u6027\u80fd\u7684\u7f51\u9875\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001ASP.NET MVC<\/h3>\n<\/p>\n<p><p><strong>ASP.NET MVC<\/strong> \u63d0\u4f9b\u4e86\u4e00\u4e2a\u5f3a\u5236\u4f7f\u7528MVC\u6a21\u5f0f\u7684\u5e73\u53f0\uff0c\u8fd9\u4fc3\u8fdb\u4e86\u5728\u5f00\u53d1\u65f6\u7684\u529f\u80fd\u5206\u79bb\uff0c\u4f7f\u5f97\u5f00\u53d1\u8fc7\u7a0b\u53d8\u5f97\u66f4\u52a0\u6e05\u6670\u548c\u6709\u7ec4\u7ec7\u3002\u901a\u8fc7\u5c06\u5e94\u7528\u7a0b\u5e8f\u5206\u5272\u6210\u6a21\u578b\uff08Model\uff09\u3001\u89c6\u56fe\uff08View\uff09\u548c\u63a7\u5236\u5668\uff08Controller\uff09\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u72ec\u7acb\u5730\u5de5\u4f5c\u5728\u5e94\u7528\u7a0b\u5e8f\u7684\u4e0d\u540c\u90e8\u5206\u4e0a\uff0c\u4ece\u800c\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\u548c\u4ee3\u7801\u7684\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><p><strong>\u7279\u6027\u4ecb\u7ecd<\/strong>\uff1aASP.NET MVC\u7684\u4e00\u4e2a\u91cd\u8981\u7279\u6027\u662f\u5b83\u7684\u8def\u7531\u7cfb\u7edf\u3002\u8fd9\u4e2a\u7cfb\u7edf\u5141\u8bb8\u5f00\u53d1\u8005\u5b9a\u4e49\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684URL\u683c\u5f0f\uff0c\u5e76\u5c06\u8fd9\u4e9bURL\u6620\u5c04\u5230\u7279\u5b9a\u7684\u63a7\u5236\u5668\u52a8\u4f5c\u4e0a\u3002\u8fd9\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u7528\u6027\u548c\u641c\u7d22\u5f15\u64ce\u4f18\u5316\uff08SEO\uff09\u6027\u80fd\uff0c\u800c\u4e14\u8fd8\u63d0\u4f9b\u4e86\u66f4\u7075\u6d3b\u7684URL\u547d\u540d\u548c\u7ec4\u7ec7\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001NancyFX<\/h3>\n<\/p>\n<p><p><strong>NancyFX<\/strong> \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u3001\u652f\u6301Mono\u7684.NET\u6846\u67b6\uff0c\u76f8\u5bf9\u4e8e\u91cd\u91cf\u7ea7\u7684ASP.NET MVC\u6846\u67b6\u800c\u8a00\uff0cNancyFX\u63d0\u4f9b\u4e86\u4e00\u4e2a\u66f4\u52a0\u7b80\u5355\u3001\u7075\u6d3b\u7684\u65b9\u5f0f\u6765\u6784\u5efaHTTP\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><p><strong>\u7279\u6027\u4ecb\u7ecd<\/strong>\uff1aNancyFX\u7684\u8bbe\u8ba1\u7406\u5ff5\u662f\u201c\u8d85\u7ea7\u7b80\u5355\u201d\uff0c\u5b83\u6452\u5f03\u4e86ASP.NET MVC\u4e2d\u590d\u6742\u7684\u914d\u7f6e\u548c\u7ea6\u675f\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u66f4\u4e3a\u81ea\u7531\u548c\u5f00\u653e\u7684\u5f00\u53d1\u73af\u5883\u3002\u8fd9\u4f7f\u5f97\u5f00\u53d1\u8005\u53ef\u4ee5\u5feb\u901f\u6784\u5efa\u51fa\u5c0f\u578b\u4f46\u529f\u80fd\u5168\u9762\u7684Web\u5e94\u7528\u548cRESTful\u670d\u52a1\u3002NancyFX\u540c\u65f6\u652f\u6301\u591a\u79cd\u89c6\u56fe\u5f15\u64ce\uff0c\u5305\u62ecRazor\u3001DotLiquid\u7b49\uff0c\u8fd9\u4e3a\u5f00\u53d1\u8005\u5728\u6784\u5efaUI\u65f6\u63d0\u4f9b\u4e86\u7075\u6d3b\u6027\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001MonoRail<\/h3>\n<\/p>\n<p><p><strong>MonoRail<\/strong> \u5219\u662f\u53e6\u4e00\u79cd\u4e0d\u540c\u4e8eASP.NET MVC\u7684.NET\u6846\u67b6\u3002\u5b83\u66f4\u52a0\u5173\u6ce8\u4e8e\u901a\u8fc7\u7ea6\u5b9a\u4f18\u4e8e\u914d\u7f6e\u7684\u539f\u5219\u6765\u7b80\u5316Web\u5e94\u7528\u7684\u5f00\u53d1\u3002<\/p>\n<\/p>\n<p><p><strong>\u7279\u6027\u4ecb\u7ecd<\/strong>\uff1aMonoRail\u9f13\u52b1\u5f00\u53d1\u4eba\u5458\u9075\u5faaMVC\u6a21\u5f0f\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u540c\u65f6\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684Ajax\u652f\u6301\u548c\u5bf9Mono\u6846\u67b6\u7684\u652f\u6301\u3002MonoRail\u7684\u8bbe\u8ba1\u54f2\u5b66\u662f\u4f7fWeb\u5e94\u7528\u5f00\u53d1\u53d8\u5f97\u7b80\u5355\u76f4\u63a5\uff0c\u540c\u65f6\u51cf\u5c11\u4e0d\u5fc5\u8981\u7684\u914d\u7f6e\u548c\u5f15\u5bfc\u4ee3\u7801\uff0c\u8fd9\u4e00\u70b9\u4e0eASP.NET MVC\u6846\u67b6\u4e2d\u63d0\u4f9b\u7684\u5e7f\u6cdb\u914d\u7f6e\u9009\u9879\u5f62\u6210\u9c9c\u660e\u5bf9\u6bd4\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>GitHub \u4e0a\u7684\u8fd9\u4e9b.NET MVC\u6846\u67b6\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u9009\u62e9\uff0c\u4ee5\u6ee1\u8db3\u4e0d\u540c\u5f00\u53d1\u9700\u6c42\u3002<strong>ASP.NET MVC<\/strong>\u51ed\u501f\u5176\u5f3a\u5927\u7684\u751f\u6001\u7cfb\u7edf\u3001\u5e7f\u6cdb\u7684\u793e\u533a\u652f\u6301\u548cMicrosoft\u7684\u80cc\u4e66\uff0c\u901a\u5e38\u662f\u5f00\u53d1\u5927\u578b\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u7684\u9996\u9009\u3002<strong>NancyFX<\/strong>\u548c<strong>MonoRail<\/strong>\u4ee5\u5176\u8f7b\u91cf\u7ea7\u3001\u7075\u6d3b\u6027\u7279\u70b9\u5438\u5f15\u4e86\u8bb8\u591a\u5f00\u53d1\u8005\uff0c\u5c24\u5176\u9002\u5408\u9700\u8981\u5feb\u901f\u5f00\u53d1\u7684\u5c0f\u578b\u9879\u76ee\u6216\u5fae\u670d\u52a1\u3002\u9009\u62e9\u54ea\u4e2a\u6846\u67b6\u53d6\u51b3\u4e8e\u9879\u76ee\u7684\u5177\u4f53\u9700\u6c42\u3001\u5f00\u53d1\u56e2\u961f\u7684\u504f\u597d\u4ee5\u53ca\u9879\u76ee\u7684\u89c4\u6a21\u548c\u590d\u6742\u5ea6\u3002\u638c\u63e1\u8fd9\u4e9b\u6846\u67b6\u7684\u5173\u952e\u7279\u6027\u548c\u4f18\u52bf\uff0c\u5bf9\u4e8e\u5f00\u53d1\u9ad8\u6548\u3001\u53ef\u7ef4\u62a4\u7684.NET\u5e94\u7528\u81f3\u5173\u91cd\u8981\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u6709\u54ea\u4e9bGitHub\u4e0a\u70ed\u95e8\u7684.NET MVC\u6846\u67b6\u53ef\u4f9b\u9009\u62e9\uff1f<\/strong><\/p>\n<p>\u5728GitHub\u4e0a\u6709\u8bb8\u591a\u53d7\u6b22\u8fce\u7684.NET MVC\u6846\u67b6\u53ef\u4f9b\u9009\u62e9\uff0c\u4f8b\u5982ASP.NET Core MVC\u3001Dapper\u3001Entity Framework Core\u7b49\u3002\u8fd9\u4e9b\u6846\u67b6\u90fd\u5177\u6709\u5f3a\u5927\u7684\u529f\u80fd\u548c\u5e7f\u6cdb\u7684\u7528\u6237\u57fa\u7840\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u5feb\u901f\u6784\u5efa\u7a33\u5b9a\u53ef\u9760\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p><strong>2. \u6211\u5e94\u8be5\u9009\u62e9\u54ea\u4e2aGitHub\u4e0a\u7684.NET MVC\u6846\u67b6\u6765\u5f00\u53d1\u6211\u7684\u5e94\u7528\u7a0b\u5e8f\uff1f<\/strong><\/p>\n<p>\u9009\u62e9\u5408\u9002\u7684.NET MVC\u6846\u67b6\u4e3b\u8981\u53d6\u51b3\u4e8e\u60a8\u7684\u9879\u76ee\u9700\u6c42\u548c\u504f\u597d\u3002ASP.NET Core MVC\u662f\u4e00\u4e2a\u5f3a\u5927\u7684\u9009\u62e9\uff0c\u53ef\u4ee5\u6784\u5efa\u8de8\u5e73\u53f0\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5177\u6709\u7075\u6d3b\u7684\u8def\u7531\u3001\u6a21\u578b\u7ed1\u5b9a\u3001\u89c6\u56fe\u5f15\u64ce\u7b49\u529f\u80fd\u3002Dapper\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684ORM\u5de5\u5177\uff0c\u9002\u5408\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u76f4\u63a5\u64cd\u4f5c\u3002Entity Framework Core\u662f\u4e00\u4e2a\u5168\u529f\u80fd\u7684ORM\u5de5\u5177\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u9ad8\u7ea7\u529f\u80fd\uff0c\u5982\u8fc1\u79fb\u3001\u7f13\u5b58\u7b49\u3002<\/p>\n<p><strong>3. \u6709\u4ec0\u4e48.NET MVC\u6846\u67b6\u53ef\u4ee5\u5e2e\u52a9\u6211\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff1f<\/strong><\/p>\n<p>GitHub\u4e0a\u6709\u4e00\u4e9b.NET MVC\u6846\u67b6\u53ef\u4ee5\u5e2e\u52a9\u60a8\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u4f8b\u5982\uff0cASP.NET Core Identity\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5feb\u901f\u5b9e\u65bd\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\u529f\u80fd\uff0c\u4ece\u800c\u51cf\u5c11\u91cd\u590d\u7684\u4ee3\u7801\u7f16\u5199\u3002\u6b64\u5916\uff0cAutoMapper\u53ef\u4ee5\u5e2e\u52a9\u60a8\u8f7b\u677e\u5730\u5728\u6a21\u578b\u4e4b\u95f4\u8fdb\u884c\u5bf9\u8c61\u6620\u5c04\uff0c\u4ece\u800c\u4f7f\u6570\u636e\u5904\u7406\u66f4\u52a0\u7b80\u5355\u3002\u8fd8\u6709\u4e00\u4e9b\u5176\u4ed6\u7684\u5de5\u5177\u548c\u5e93\uff0c\u5982Swagger\u3001Serilog\u7b49\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u7b80\u5316\u5f00\u53d1\u8fc7\u7a0b\uff0c\u5e76\u589e\u52a0\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u7ef4\u62a4\u6027\u548c\u53ef\u6d4b\u8bd5\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"GitHub\u4e0a\u62e5\u6709\u4f17\u591a\u51fa\u8272\u7684.NET MVC\u6846\u67b6\uff0c\u4e3b\u8981\u5305\u62ecASP.NET MVC\u3001NancyFX\u3001MonoRA [&hellip;]","protected":false},"author":3,"featured_media":315621,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/315596"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=315596"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/315596\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/315621"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=315596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=315596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=315596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}