{"id":566,"date":"2025-04-05T03:15:34","date_gmt":"2025-04-04T19:15:34","guid":{"rendered":"https:\/\/www.hyy.net\/?p=566"},"modified":"2025-04-05T03:15:34","modified_gmt":"2025-04-04T19:15:34","slug":"asp-net-core-in-action-preface","status":"publish","type":"post","link":"https:\/\/diji.net\/?p=566","title":{"rendered":"ASP.NET Core in Action Preface"},"content":{"rendered":"<h2>ASP.NET Core in Action Preface<\/h2>\n<h2>preface<\/h2>\n<h2>\u524d\u8a00<\/h2>\n<p>ASP.NET has a long history; Microsoft released the first version in 2002 as part of the original .NET Framework 1.0. Since then, it's been through multiple iterations, each version bringing added features and extensibility. Each iteration, however, was built on the same underlying framework provided by System.Web.dll. This library is part of the .NET Framework, so it comes preinstalled in all versions of Windows.<\/p>\n<p>ASP.NET\u6709\u7740\u60a0\u4e45\u7684\u5386\u53f2;Microsoft\u4e8e2002\u5e74\u53d1\u5e03\u4e86\u7b2c\u4e00\u4e2a\u7248\u672c\uff0c\u4f5c\u4e3a\u539f\u59cb.NET Framework1.0\u7684\u4e00\u90e8\u5206\u3002\u4ece\u90a3\u65f6\u8d77\uff0c\u5b83\u7ecf\u5386\u4e86\u591a\u6b21\u8fed\u4ee3\uff0c\u6bcf\u4e2a\u7248\u672c\u90fd\u5e26\u6765\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u53ef\u6269\u5c55\u6027\u3002\u4f46\u662f\uff0c\u6bcf\u4e2a\u8fed\u4ee3\u90fd\u6784\u5efa\u5728System.Web.dll\u63d0\u4f9b\u7684\u76f8\u540c\u5e95\u5c42\u6846\u67b6\u4e4b\u4e0a\u3002\u6b64\u5e93\u662f.NET Framework\u7684\u4e00\u90e8\u5206\uff0c\u56e0\u6b64\u5b83\u9884\u5b89\u88c5\u5728\u6240\u6709\u7248\u672c\u7684Windows\u4e2d\u3002<\/p>\n<p>This brings mixed blessings. On one hand, the ASP.NET 4.X framework today is a reliable, battle-tested platform for building modern applications on Windows. On the other hand, it is limited by this reliance; changes to the underlying System.Web.dll are far-reaching and consequently slow to roll out, and it fundamentally excludes the many developers who are building and deploying to Linux or macOS.<\/p>\n<p>\u8fd9\u5e26\u6765\u4e86\u559c\u5fe7\u53c2\u534a\u3002\u4e00\u65b9\u9762\uff0c\u5982\u4eca\u7684ASP.NET4.X\u6846\u67b6\u662f\u4e00\u4e2a\u53ef\u9760\u7684\u3001\u4e45\u7ecf\u8003\u9a8c\u7684\u5e73\u53f0\uff0c\u7528\u4e8e\u5728Windows\u4e0a\u6784\u5efa\u73b0\u4ee3\u5e94\u7528\u7a0b\u5e8f\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u5b83\u53d7\u5230\u8fd9\u79cd\u4f9d\u8d56\u7684\u9650\u5236;\u5bf9\u5e95\u5c42System.Web.dll\u7684\u66f4\u6539\u5f71\u54cd\u6df1\u8fdc\uff0c\u56e0\u6b64\u63a8\u51fa\u901f\u5ea6\u8f83\u6162\uff0c\u4ece\u6839\u672c\u4e0a\u5c06\u8bb8\u591a\u6b63\u5728\u6784\u5efa\u548c\u90e8\u7f72\u5230Linux\u6216macOS\u7684\u5f00\u53d1\u4eba\u5458\u6392\u9664\u5728\u5916\u3002<\/p>\n<p>When I began looking into ASP.NET Core, I was one of those developers. A Windows user at heart, I was issued a Mac by my employer, so I was stuck working in a virtual machine all day. ASP.NET Core promised to change all that, allowing me to develop natively on both my Windows machine and my Mac.<\/p>\n<p>\u5f53\u6211\u5f00\u59cb\u7814\u7a76ASP.NET Core\u65f6\uff0c\u6211\u5c31\u662f\u5176\u4e2d\u4e4b\u4e00\u3002\u6211\u672c\u8d28\u4e0a\u662fWindows\u7528\u6237\uff0c\u6211\u7684\u96c7\u4e3b\u7ed9\u6211\u53d1\u4e86\u4e00\u53f0Mac\uff0c\u6240\u4ee5\u6211\u6574\u5929\u90fd\u88ab\u56f0\u5728\u865a\u62df\u673a\u4e2d\u5de5\u4f5c\u3002ASP.NET Core\u627f\u8bfa\u6539\u53d8\u8fd9\u4e00\u5207\uff0c\u8ba9\u6211\u53ef\u4ee5\u5728Windows\u673a\u5668\u548cMac\u4e0a\u8fdb\u884c\u539f\u751f\u5f00\u53d1\u3002<\/p>\n<p>I was relatively late to the party in many respects, taking an active interest only just before the RC2 release of ASP.NET Core. By this point there had already been eight (!) beta releases, many of which contained signi\ufb01cant breaking changes. By not diving in fully until RC2, I was spared the pain of dodgy tooling and changing APIs.<\/p>\n<p>\u5728\u8bb8\u591a\u65b9\u9762\uff0c\u6211\u52a0\u5165\u6d3e\u5bf9\u7684\u65f6\u95f4\u76f8\u5bf9\u8f83\u665a\uff0c\u53ea\u662f\u5728ASP.NET Core\u7684RC2\u53d1\u5e03\u4e4b\u524d\u624d\u5f00\u59cb\u79ef\u6781\u5173\u6ce8\u3002\u6b64\u65f6\u5df2\u7ecf\u67098\u4e2abeta\u7248\u672c\uff0c\u5176\u4e2d\u8bb8\u591a\u90fd\u5305\u542b\u91cd\u5927\u7684\u7834\u574f\u6027\u53d8\u5316\u3002\u7531\u4e8e\u76f4\u5230RC2\u624d\u5b8c\u5168\u6df1\u5165\u7814\u7a76\uff0c\u6211\u514d\u4e8e\u72e1\u733e\u7684\u5de5\u5177\u548c\u66f4\u6539API\u7684\u75db\u82e6\u3002<\/p>\n<p>What I saw at that point really impressed me. ASP.NET Core let developers use their existing knowledge of the .NET Framework, and of ASP.NET MVC applications in particular, while baking in current best practices such as dependency injection, strongly typed configuration, and logging. On top of that, you could build and deploy cross-platform. I was sold.<\/p>\n<p>\u6211\u5f53\u65f6\u6240\u770b\u5230\u7684\u771f\u7684\u7ed9\u6211\u7559\u4e0b\u4e86\u6df1\u523b\u7684\u5370\u8c61\u3002ASP.NET Core\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u4f7f\u7528\u4ed6\u4eec\u73b0\u6709\u7684.NET Framework\u77e5\u8bc6\uff0c\u7279\u522b\u662fASP.NET MVC\u5e94\u7528\u7a0b\u5e8f\uff0c\u540c\u65f6\u91c7\u7528\u5f53\u524d\u7684\u6700\u4f73\u5b9e\u8df5\uff0c\u5982\u4f9d\u8d56\u9879\u6ce8\u5165\u3001\u5f3a\u7c7b\u578b\u914d\u7f6e\u548c\u65e5\u5fd7\u8bb0\u5f55\u3002\u6700\u91cd\u8981\u7684\u662f\uff0c\u60a8\u53ef\u4ee5\u8de8\u5e73\u53f0\u6784\u5efa\u548c\u90e8\u7f72\u3002\u6211\u88ab\u8bf4\u670d\u4e86\u3002<\/p>\n<p>This book came about largely due to my approach to learning about ASP.NET Core. Rather than simply reading documentation and blog posts, I decided to try something new and start writing about what I learned. Each week I would dedicate some time to exploring a new aspect of ASP.NET Core, and I\u2019d write a blog post about it. When the possibility of writing a book came about, I jumped at the chance\u2014another excuse to dive further into the framework!<\/p>\n<p>\u8fd9\u672c\u4e66\u7684\u8bde\u751f\u5f88\u5927\u7a0b\u5ea6\u4e0a\u662f\u7531\u4e8e\u6211\u5b66\u4e60ASP.NET Core\u7684\u65b9\u6cd5\u3002\u6211\u51b3\u5b9a\u5c1d\u8bd5\u4e00\u4e9b\u65b0\u7684\u4e1c\u897f\uff0c\u5e76\u5f00\u59cb\u5199\u4e0b\u6211\u5b66\u5230\u7684\u4e1c\u897f\uff0c\u800c\u4e0d\u662f\u7b80\u5355\u5730\u9605\u8bfb\u6587\u6863\u548c\u535a\u5ba2\u6587\u7ae0\u3002\u6bcf\u5468\u6211\u90fd\u4f1a\u82b1\u4e00\u4e9b\u65f6\u95f4\u6765\u63a2\u7d22ASP.NET Core\u7684\u4e00\u4e2a\u65b0\u65b9\u9762\uff0c\u5e76\u5199\u4e00\u7bc7\u5173\u4e8e\u5b83\u7684\u535a\u5ba2\u6587\u7ae0\u3002\u5f53\u5199\u4e66\u7684\u53ef\u80fd\u6027\u51fa\u73b0\u65f6\uff0c\u6211\u6293\u4f4f\u4e86\u8fd9\u4e2a\u673a\u4f1a\u2014\u2014\u8fd9\u662f\u8fdb\u4e00\u6b65\u6df1\u5165\u7814\u7a76\u6846\u67b6\u7684\u53e6\u4e00\u4e2a\u501f\u53e3\uff01<\/p>\n<p>Since I started this book, a lot has changed, both with the book and ASP.NET Core. The first major release of the framework in June 2016 still had many rough edges, in particular around the tooling experience. With the release of<br \/>\n.NET 7 in November 2022, ASP.NET Core has really come into its own, with the APIs and tooling reaching mature levels.<\/p>\n<p>\u81ea\u4ece\u6211\u5f00\u59cb\u5199\u8fd9\u672c\u4e66\u4ee5\u6765\uff0c\u8fd9\u672c\u4e66\u548cASP.NETCore\u90fd\u53d1\u751f\u4e86\u5f88\u591a\u53d8\u5316\u3002\u8be5\u6846\u67b6\u7684\u7b2c\u4e00\u4e2a\u4e3b\u8981\u7248\u672c\u4e8e2016\u5e746\u6708\u53d1\u5e03\uff0c\u4f46\u4ecd\u6709\u8bb8\u591a\u7c97\u7cd9\u7684\u8fb9\u7f18\uff0c\u5c24\u5176\u662f\u5728\u5de5\u5177\u4f53\u9a8c\u65b9\u9762\u3002\u968f\u7740.NET7\u57282022\u5e7411\u6708\u53d1\u5e03\uff0cASP.NET Core\u5df2\u7ecf\u771f\u6b63\u5d2d\u9732\u5934\u89d2\uff0cAPI\u548c\u5de5\u5177\u8fbe\u5230\u4e86\u6210\u719f\u7684\u6c34\u5e73\u3002<\/p>\n<p>Updates to the framework in .NET 6 and .NET 7 signi\ufb01cantly simpli\ufb01ed the getting-started experience for newcomers with the introduction of minimal hosting and minimal APIs, which provide a terser, simpler approach to writing APIs, much closer to the experience in other languages. You can get straight into building your app's functionality without having to understand architecture first.<\/p>\n<p>.NET6\u548c.NET7\u4e2d\u5bf9\u6846\u67b6\u7684\u66f4\u65b0\u901a\u8fc7\u5f15\u5165\u6700\u5c0f\u6258\u7ba1\u548c\u6700\u5c0fAPI\u663e\u8457\u7b80\u5316\u4e86\u65b0\u624b\u7684\u5165\u95e8\u4f53\u9a8c\uff0c\u8fd9\u4e9bAPI\u63d0\u4f9b\u4e86\u4e00\u79cd\u66f4\u7b80\u6d01\u3001\u66f4\u7b80\u5355\u7684API\u7f16\u5199\u65b9\u6cd5\uff0c\u66f4\u63a5\u8fd1\u5176\u4ed6\u8bed\u8a00\u4e2d\u7684\u4f53\u9a8c\u3002\u60a8\u53ef\u4ee5\u76f4\u63a5\u5f00\u59cb\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u7684\u529f\u80fd\uff0c\u800c\u65e0\u9700\u5148\u4e86\u89e3\u67b6\u6784\u3002<\/p>\n<p>For some experienced ASP.NET Core developers, these changes can feel regressive and unstructured, but if you're one of them, I encourage you to give them a chance and to build your own structure and patterns. For brevity and clarity of the examples in this book, I often put the whole code for your app in one \ufb01le, but don't think that's how you need to write your real applications. You're free to create helper methods, classes, and any structure that helps keep your applications maintainable while taking advantage of the performance bene\ufb01ts of minimal APIs.<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e9b\u7ecf\u9a8c\u4e30\u5bcc\u7684ASP.NET Core\u5f00\u53d1\u4eba\u5458\u6765\u8bf4\uff0c\u8fd9\u4e9b\u53d8\u5316\u53ef\u80fd\u4f1a\u8ba9\u4eba\u611f\u89c9\u662f\u5012\u9000\u548c\u975e\u7ed3\u6784\u5316\u7684\uff0c\u4f46\u5982\u679c\u4f60\u662f\u5176\u4e2d\u4e4b\u4e00\uff0c\u6211\u9f13\u52b1\u4f60\u7ed9\u4ed6\u4eec\u4e00\u4e2a\u673a\u4f1a\uff0c\u5e76\u6784\u5efa\u4f60\u81ea\u5df1\u7684\u7ed3\u6784\u548c\u6a21\u5f0f\u3002\u4e3a\u4e86\u7b80\u6d01\u660e\u4e86\u5730\u4ecb\u7ecd\u672c\u4e66\u4e2d\u7684\u793a\u4f8b\uff0c\u6211\u7ecf\u5e38\u5c06\u5e94\u7528\u7a0b\u5e8f\u7684\u6574\u4e2a\u4ee3\u7801\u653e\u5728\u4e00\u4e2a\u6587\u4ef6\u4e2d\uff0c\u4f46\u4e0d\u8981\u8ba4\u4e3a\u8fd9\u662f\u7f16\u5199\u5b9e\u9645\u5e94\u7528\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u60a8\u53ef\u4ee5\u81ea\u7531\u521b\u5efa\u5e2e\u52a9\u7a0b\u5e8f\u65b9\u6cd5\u3001\u7c7b\u548c\u4efb\u4f55\u7ed3\u6784\uff0c\u4ee5\u5e2e\u52a9\u4fdd\u6301\u5e94\u7528\u7a0b\u5e8f\u7684\u53ef\u7ef4\u62a4\u6027\uff0c\u540c\u65f6\u5229\u7528\u6700\u5c0fAPI\u7684\u6027\u80fd\u4f18\u52bf\u3002<\/p>\n<p>This book covers everything you need to get started with ASP.NET Core, whether you\u2019re new to web development or an existing ASP.NET developer. It focuses on the framework itself, so I don\u2019t go into details about client-side frameworks such as Angular and React or technologies like Docker. I also don\u2019t cover all the new features in .NET 7, such as Blazor and gRPC; instead, I provide links where you can \ufb01nd more information.<\/p>\n<p>\u672c\u4e66\u6db5\u76d6\u4e86\u5f00\u59cb\u4f7f\u7528ASP.NETCore\u6240\u9700\u7684\u4e00\u5207\uff0c\u65e0\u8bba\u60a8\u662fWeb\u5f00\u53d1\u65b0\u624b\u8fd8\u662f\u73b0\u6709\u7684ASP.NET\u5f00\u53d1\u4eba\u5458\u3002\u5b83\u4fa7\u91cd\u4e8e\u6846\u67b6\u672c\u8eab\uff0c\u56e0\u6b64\u6211\u4e0d\u4f1a\u8be6\u7ec6\u4ecb\u7ecd\u5ba2\u6237\u7aef\u6846\u67b6\uff08\u5982Angular\u548cReact\uff09\u6216Docker\u7b49\u6280\u672f\u3002\u6211\u4e5f\u6ca1\u6709\u4ecb\u7ecd.NET7\u4e2d\u7684\u6240\u6709\u65b0\u529f\u80fd\uff0c\u4f8b\u5982Blazor\u548cgRPC;\u76f8\u53cd\uff0c\u6211\u63d0\u4f9b\u4e86\u94fe\u63a5\uff0c\u60a8\u53ef\u4ee5\u5728\u5176\u4e2d\u627e\u5230\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p>In this edition, I have signi\ufb01cantly expanded and rearranged many chapters compared with previous editions of the book; some chapters have been split into more manageable sizes.<\/p>\n<p>\u4e0e\u672c\u4e66\u7684\u524d\u51e0\u4e2a\u7248\u672c\u76f8\u6bd4\uff0c\u5728\u8fd9\u4e2a\u7248\u672c\u4e2d\uff0c\u6211\u663e\u7740\u6269\u5c55\u548c\u91cd\u65b0\u6392\u5217\u4e86\u8bb8\u591a\u7ae0\u8282;\u4e00\u4e9b\u7ae0\u8282\u88ab\u5206\u6210\u4e86\u66f4\u6613\u4e8e\u7ba1\u7406\u7684\u5927\u5c0f\u3002<\/p>\n<p>The early chapters feature a lot of new content focusing on minimal APIs and minimal hosting introduced in .NET 6.<\/p>\n<p>\u524d\u51e0\u7ae0\u5305\u542b\u8bb8\u591a\u65b0\u5185\u5bb9\uff0c\u91cd\u70b9\u4ecb\u7ecd.NET6\u4e2d\u5f15\u5165\u7684\u6700\u5c0fAPI\u548c\u6700\u5c0f\u6258\u7ba1\u3002<\/p>\n<p>I \ufb01nd it a joy to work with ASP.NET Core apps compared with apps using the previous version of ASP.NET, and I hope that my passion comes through in this book!<\/p>\n<p>\u4e0e\u4f7f\u7528\u4ee5\u524d\u7248\u672c\u7684ASP.NET\u7684\u5e94\u7528\u7a0b\u5e8f\u76f8\u6bd4\uff0c\u6211\u53d1\u73b0\u4f7f\u7528ASP.NETCore\u5e94\u7528\u7a0b\u5e8f\u662f\u4e00\u79cd\u4e50\u8da3\uff0c\u6211\u5e0c\u671b\u6211\u7684\u70ed\u60c5\u5728\u8fd9\u672c\u4e66\u4e2d\u5f97\u5230\u4f53\u73b0\uff01<\/p>\n<h2>acknowledgments\u200c<\/h2>\n<h2>\u81f4\u8c22<\/h2>\n<p>Although there is only one name on the cover of this book, a plethora of people contributed to both its writing and production. In this section I\u2019d like to thank everyone who encouraged me, contributed, and put up with me for the past year.<\/p>\n<p>\u867d\u7136\u8fd9\u672c\u4e66\u7684\u5c01\u9762\u4e0a\u53ea\u6709\u4e00\u4e2a\u540d\u5b57\uff0c\u4f46\u5f88\u591a\u4eba\u90fd\u4e3a\u5b83\u7684\u5199\u4f5c\u548c\u5236\u4f5c\u505a\u51fa\u4e86\u8d21\u732e\u3002\u5728\u672c\u8282\u4e2d\uff0c\u6211\u8981\u611f\u8c22\u8fc7\u53bb\u4e00\u5e74\u4e2d\u6240\u6709\u9f13\u52b1\u6211\u3001\u505a\u51fa\u8d21\u732e\u548c\u5bb9\u5fcd\u6211\u7684\u4eba\u3002<\/p>\n<p>First, and most important, I\u2019d like to thank my girlfriend, Becky. Your continual support and encouragement means the world to me and has kept me going through such a busy time. You\u2019ve taken the brunt of my stress and pressure, and I\u2019m eternally grateful. I love you always.<\/p>\n<p>\u9996\u5148\uff0c\u4e5f\u662f\u6700\u91cd\u8981\u7684\uff0c\u6211\u8981\u611f\u8c22\u6211\u7684\u5973\u670b\u53cbBecky\u3002\u60a8\u4e00\u76f4\u4ee5\u6765\u7684\u652f\u6301\u548c\u9f13\u52b1\u5bf9\u6211\u6765\u8bf4\u610f\u5473\u7740\u6574\u4e2a\u4e16\u754c\uff0c\u8ba9\u6211\u5ea6\u8fc7\u4e86\u5982\u6b64\u5fd9\u788c\u7684\u65f6\u5149\u3002\u4f60\u9996\u5f53\u5176\u51b2\u5730\u627f\u53d7\u4e86\u6211\u7684\u538b\u529b\u548c\u538b\u529b\uff0c\u6211\u6c38\u8fdc\u611f\u6fc0\u4e0d\u5c3d\u3002\u6211\u6c38\u8fdc\u7231\u4f60\u3002<\/p>\n<p>I\u2019d also like to thank my whole family for their support, in particular my parents, Jan and Bob, for putting up with my ranting; my sister, Amanda, for your always upbeat chats; and of course, Goose, for diligently ensuring that I take regular breaks for walks and tummy tickles.<\/p>\n<p>\u6211\u8fd8\u8981\u611f\u8c22\u6211\u5168\u5bb6\u4eba\u7684\u652f\u6301\uff0c\u7279\u522b\u662f\u6211\u7684\u7236\u6bcdJan\u548cBob\uff0c\u4ed6\u4eec\u5fcd\u53d7\u4e86\u6211\u7684\u5486\u54ee;\u6211\u7684\u59d0\u59d0Amanda\uff0c\u611f\u8c22\u4f60\u603b\u662f\u4e50\u89c2\u7684\u804a\u5929;\u5f53\u7136\uff0c\u8fd8\u6709Goose\uff0c\u4ed6\u52e4\u594b\u5730\u786e\u4fdd\u6211\u5b9a\u671f\u4f11\u606f\u6563\u6b65\u548c\u6320\u809a\u5b50\u75d2\u75d2\u3002<\/p>\n<p>On a professional level, I\u2019d like to thank Manning for giving me this opportunity. Brian Sawyer \u201cdiscovered\u201d me for the \ufb01rst version of this book and encouraged me to tackle the subsequent versions. Marina Michaels served as my development editor for the third time running and again proved to be alternately meticulous, critical, encouraging, and enthusiastic. The book is undoubtedly better thanks to your involvement.<\/p>\n<p>\u5728\u4e13\u4e1a\u5c42\u9762\u4e0a\uff0c\u6211\u8981\u611f\u8c22Manning\u7ed9\u6211\u8fd9\u4e2a\u673a\u4f1a\u3002BrianSawyer\u5728\u8fd9\u672c\u4e66\u7684\u7b2c\u4e00\u4e2a\u7248\u672c\u4e2d\u201c\u53d1\u73b0\u201d\u4e86\u6211\uff0c\u5e76\u9f13\u52b1\u6211\u5904\u7406\u540e\u7eed\u7248\u672c\u3002MarinaMichaels\u62c5\u4efb\u6211\u7684\u7b2c\u4e09\u6b21\u62c5\u4efb\u5f00\u53d1\u7f16\u8f91\uff0c\u5e76\u518d\u6b21\u8bc1\u660e\u4ed6\u65f6\u800c\u7ec6\u81f4\u3001\u6279\u5224\u3001\u9f13\u52b1\u548c\u70ed\u60c5\u3002\u591a\u4e8f\u4e86\u60a8\u7684\u53c2\u4e0e\uff0c\u8fd9\u672c\u4e66\u65e0\u7591\u4f1a\u66f4\u597d\u3002<\/p>\n<p>Thank you to my review editor, Adriana Sabo, and to all the reviewers: Alen Adani\u0107, Ben McNamara, Bela Ist\u00f3k, Darrin Bishop, Dennis Liabenow, Al Pezewski, Emmanouil Chardalas, Foster Haines, Onofrei George, John Guthrie, Jean-Fran\u00e7ois Morin, Pedro Seromenho, Joe Cuevas, Jos\u00e9 Antonio Martinez Perez, Joe Suchy, Luis Moux, Milan \u0160arenac, Milorad Imbra, Nik Rimington, Nitin Ainani, Oliver Korten, Raushan Jha, Richard Young, Rick Beerendonk, Ron Lease, Ruben Vandeginste, Sumit K. Singh, Towhidul Bashar, Daniel V\u00e1squez, and Will Lopez. Your suggestions helped make this a better book.<\/p>\n<p>\u611f\u8c22\u6211\u7684\u8bc4\u8bba\u7f16\u8f91AdrianaSabo\u548c\u6240\u6709\u8bc4\u8bba\u8005\uff1aAlenAdani\u0107\u3001BenMcNamara\u3001BelaIst\u00f3k\u3001DarrinBishop\u3001DennisLiabenow\u3001AlPezewski\u3001EmmanouilChardalas\u3001FosterHaines\u3001OnofreiGeorge\u3001JohnGuthrie\u3001Jean-Fran\u00e7oisMorin\u3001PedroSeromenho\u3001JoeCuevas\u3001Jos\u00e9AntonioMartinezPerez\u3001JoeSuchy\u3001LuisMoux\u3001Milan\u0160arenac\u3001MiloradImbra\u3001NikRimington\u3001NitinAinani\u3001OliverKorten\u3001RaushanJha\u3001RichardYoung\u3001RickBeerendonk\u3001RonLease\u3001RubenVandeginste\u3001SumitK.Singh\u3001TowhidulBashar\u3001DanielV\u00e1squez\u548cWillLopez\u3002\u60a8\u7684\u5efa\u8bae\u5e2e\u52a9\u4f7f\u8fd9\u672c\u4e66\u53d8\u5f97\u66f4\u597d\u3002<\/p>\n<p>My thanks go to the technical editor for this book, Filip Wojcieszyn, who is a founder and maintainer of several popular open-source projects, frequent conference speaker, and a Microsoft MVP. Filip provided invaluable feedback, highlighting my incorrect assumptions and technical biases, and ensuring technical correctness in everything I wrote.<\/p>\n<p>\u6211\u8981\u611f\u8c22\u672c\u4e66\u7684\u6280\u672f\u7f16\u8f91Filip Wojcieszyn\uff0c\u4ed6\u662f\u51e0\u4e2a\u6d41\u884c\u7684\u5f00\u6e90\u9879\u76ee\u7684\u521b\u59cb\u4eba\u548c\u7ef4\u62a4\u8005\uff0c\u7ecf\u5e38\u5728\u4f1a\u8bae\u4e0a\u53d1\u8868\u6f14\u8bb2\uff0c\u5e76\u4e14\u662fMicrosoft MVP\u3002Filip\u63d0\u4f9b\u4e86\u5b9d\u8d35\u7684\u53cd\u9988\uff0c\u5f3a\u8c03\u4e86\u6211\u7684\u9519\u8bef\u5047\u8bbe\u548c\u6280\u672f\u504f\u89c1\uff0c\u5e76\u786e\u4fdd\u6211\u5199\u7684\u6240\u6709\u5185\u5bb9\u7684\u6280\u672f\u6b63\u786e\u6027\u3002<\/p>\n<p>I also wish to thank Tanya Wilke, who served as technical proofreader. Tanya veri\ufb01ed that the code I wrote actually ran and made sense, working through the chapters with formidable e\ufb03ciency.<\/p>\n<p>\u6211\u8fd8\u8981\u611f\u8c22\u62c5\u4efb\u6280\u672f\u6821\u5bf9\u5458\u7684Tanya Wilke\u3002Tanya\u9a8c\u8bc1\u4e86\u6211\u7f16\u5199\u7684\u4ee3\u7801\u786e\u5b9e\u8fd0\u884c\u826f\u597d\u4e14\u6709\u610f\u4e49\uff0c\u4ee5\u60ca\u4eba\u7684\u6548\u7387\u5b8c\u6210\u4e86\u5404\u4e2a\u7ae0\u8282\u3002<\/p>\n<p>To everyone at Manning who helped get this book published and marketed, a heartfelt thanks. I\u2019d also like to thank all the MEAP readers for their comments, which helped improve the book in numerous ways.<\/p>\n<p>\u8877\u5fc3\u611f\u8c22Manning\u5e2e\u52a9\u51fa\u7248\u548c\u8425\u9500\u8fd9\u672c\u4e66\u7684\u6bcf\u4e2a\u4eba\u3002\u6211\u8fd8\u8981\u611f\u8c22\u5927\u5bb6MEAP\u8bfb\u8005\u7684\u8bc4\u8bba\uff0c\u8fd9\u5728\u8bb8\u591a\u65b9\u9762\u5e2e\u52a9\u6539\u8fdb\u4e86\u8fd9\u672c\u4e66\u3002<\/p>\n<p>I would have never been in a position to write this book if not for the excellent content produced by members of the .NET community and those I follow on social media.<\/p>\n<p>\u5982\u679c\u4e0d\u662f.NET\u793e\u533a\u548c\u6211\u5728\u793e\u4ea4\u5a92\u4f53\u4e0a\u5173\u6ce8\u7684\u4eba\u3002<\/p>\n<p>Finally, thanks to all those friends who encouraged and supported me, and showed interest generally. We may not have been able to meet up as much as we\u2019d like, but I look forward to getting together for a drink as soon as it\u2019s possible.<\/p>\n<p>\u6700\u540e\uff0c\u611f\u8c22\u6240\u6709\u9f13\u52b1\u548c\u652f\u6301\u6211\u7684\u670b\u53cb\uff0c\u5e76\u666e\u904d\u8868\u73b0\u51fa\u5174\u8da3\u3002\u6211\u4eec\u53ef\u80fd\u65e0\u6cd5\u5982\u613f\u4ee5\u507f\u5730\u89c1\u9762\uff0c\u4f46\u6211\u671f\u5f85\u7740\u5c3d\u5feb\u805a\u5728\u4e00\u8d77\u559d\u4e00\u676f\u3002<\/p>\n<h2>about this book\u200c<\/h2>\n<h2>\u5173\u4e8e\u672c\u4e66<\/h2>\n<p>This book is about the ASP.NET Core framework, what it is, and how you can use it to build web applications. Although some of this content is already available online, it\u2019s scattered around the internet in disparate documents and blog posts. This book guides you through building your \ufb01rst applications, introducing additional complexity as you cement previous concepts.<\/p>\n<p>\u8fd9\u672c\u4e66\u4ecb\u7ecd\u4e86ASP.NET Core\u6846\u67b6\u3001\u5b83\u662f\u4ec0\u4e48\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u6765\u6784\u5efaWeb\u5e94\u7528\u7a0b\u5e8f\u3002\u5c3d\u7ba1\u5176\u4e2d\u4e00\u4e9b\u5185\u5bb9\u5df2\u7ecf\u5728\u7f51\u4e0a\u63d0\u4f9b\uff0c\u4f46\u5b83\u4eec\u5206\u6563\u5728\u4e92\u8054\u7f51\u4e0a\u4e0d\u540c\u7684\u6587\u6863\u548c\u535a\u5ba2\u6587\u7ae0\u4e2d\u3002\u672c\u4e66\u5c06\u6307\u5bfc\u60a8\u6784\u5efa\u60a8\u7684\u7b2c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5728\u5de9\u56fa\u4ee5\u524d\u7684\u6982\u5ff5\u65f6\u5f15\u5165\u989d\u5916\u7684\u590d\u6742\u6027\u3002<\/p>\n<p>I present each topic using relatively small examples rather than building on a single example application through the book. There are merits to both approaches, but I wanted to ensure that the focus remained on the speci\ufb01c topics being taught, without the mental overhead of navigating an increasingly large project.<\/p>\n<p>\u6211\u4f7f\u7528\u76f8\u5bf9\u8f83\u5c0f\u7684\u793a\u4f8b\u6765\u4ecb\u7ecd\u6bcf\u4e2a\u4e3b\u9898\uff0c\u800c\u4e0d\u662f\u5728\u672c\u4e66\u4e2d\u6784\u5efa\u5355\u4e2a\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u4e24\u79cd\u65b9\u6cd5\u90fd\u6709\u4f18\u70b9\uff0c\u4f46\u6211\u60f3\u786e\u4fdd\u91cd\u70b9\u4ecd\u7136\u653e\u5728\u6240\u6559\u6388\u7684\u7279\u5b9a\u4e3b\u9898\u4e0a\uff0c\u800c\u4e0d\u4f1a\u56e0\u9a7e\u9a6d\u8d8a\u6765\u8d8a\u5927\u7684\u9879\u76ee\u800c\u4ea7\u751f\u8111\u529b\u5f00\u9500\u3002<\/p>\n<p>By the end of the book, you should have a solid understanding of how to build apps with ASP.NET Core, its strengths and weaknesses, and how to use its features to build apps securely. I don\u2019t spend a lot of time on application architecture, but I make sure to point out best practices, especially where I cover architecture only super\ufb01cially for the sake of brevity.<\/p>\n<p>\u5728\u672c\u4e66\u7ed3\u675f\u65f6\uff0c\u60a8\u5e94\u8be5\u5bf9\u5982\u4f55\u4f7f\u7528ASP.NETCore\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u3001\u5176\u4f18\u7f3a\u70b9\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5176\u529f\u80fd\u5b89\u5168\u5730\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u6709\u6df1\u5165\u7684\u4e86\u89e3\u3002\u6211\u4e0d\u4f1a\u5728\u5e94\u7528\u7a0b\u5e8f\u67b6\u6784\u4e0a\u82b1\u8d39\u592a\u591a\u65f6\u95f4\uff0c\u4f46\u6211\u4f1a\u786e\u4fdd\u6307\u51fa\u6700\u4f73\u5b9e\u8df5\uff0c\u5c24\u5176\u662f\u4e3a\u4e86\u7b80\u6d01\u8d77\u89c1\uff0c\u6211\u53ea\u662f\u80a4\u6d45\u5730\u4ecb\u7ecd\u67b6\u6784\u3002<\/p>\n<h3>Who should read this book<\/h3>\n<h3>\u8c01\u5e94\u8be5\u9605\u8bfb\u8fd9\u672c\u4e66<\/h3>\n<p>This book is for C# developers who are interested in learning a cross-platform web framework. It doesn\u2019t assume that you have any experience building web applications. You may be a mobile or desktop developer, for example, though experience with ASP.NET or another web framework is undoubtedly bene\ufb01cial.<\/p>\n<p>\u672c\u4e66\u9002\u7528\u4e8e\u5bf9\u5b66\u4e60\u8de8\u5e73\u53f0Web\u6846\u67b6\u611f\u5174\u8da3\u7684C#\u5f00\u53d1\u4eba\u5458\u3002\u5b83\u4e0d\u5047\u5b9a\u60a8\u5177\u6709\u6784\u5efaWeb\u5e94\u7528\u7a0b\u5e8f\u7684\u4efb\u4f55\u7ecf\u9a8c\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u80fd\u662f\u79fb\u52a8\u6216\u684c\u9762\u5f00\u53d1\u4eba\u5458\uff0c\u4f46\u5177\u6709ASP.NET\u6216\u5176\u4ed6Web\u6846\u67b6\u7684\u7ecf\u9a8c\u65e0\u7591\u662f\u6709\u76ca\u7684\u3002<\/p>\n<p>I assume that in addition to a working knowledge of C# and .NET, you have some knowledge of common object-oriented practices and a basic understanding of relational databases in general. I assume passing familiarity with HTML and CSS and of JavaScript\u2019s place as a client-side scripting language. You don\u2019t need to know any JavaScript or CSS frameworks for this book, though ASP.NET Core works well with both if that is your forte.<\/p>\n<p>\u6211\u5047\u8bbe\u9664\u4e86C#\u548c.NET\u4e2d\uff0c\u60a8\u5bf9\u5e38\u89c1\u7684\u9762\u5411\u5bf9\u8c61\u7684\u505a\u6cd5\u6709\u4e00\u5b9a\u7684\u4e86\u89e3\uff0c\u5e76\u4e14\u5bf9\u5173\u7cfb\u6570\u636e\u5e93\u6709\u57fa\u672c\u7684\u4e86\u89e3\u3002\u6211\u5047\u8bbe\u4f60\u5bf9HTML\u548cCSS\u4ee5\u53caJavaScript\u4f5c\u4e3a\u5ba2\u6237\u7aef\u811a\u672c\u8bed\u8a00\u7684\u5730\u4f4d\u6709\u6240\u4e86\u89e3\u3002\u5bf9\u4e8e\u672c\u4e66\uff0c\u60a8\u4e0d\u9700\u8981\u4e86\u89e3\u4efb\u4f55JavaScript\u6216CSS\u6846\u67b6\uff0c\u4f46\u5982\u679c\u8fd9\u662f\u60a8\u7684\u5f3a\u9879\uff0cASP.NET Core\u53ef\u4ee5\u5f88\u597d\u5730\u4e0e\u4e24\u8005\u914d\u5408\u4f7f\u7528\u3002<\/p>\n<p>Web frameworks naturally touch on a wide range of topics, from the database and network to visual design and client- side scripting. I provide as much context as possible, and I include links to sites and books where you can learn more.<\/p>\n<p>Web\u6846\u67b6\u81ea\u7136\u6d89\u53ca\u5e7f\u6cdb\u7684\u4e3b\u9898\uff0c\u4ece\u6570\u636e\u5e93\u548c\u7f51\u7edc\u5230\u53ef\u89c6\u5316\u8bbe\u8ba1\u548c\u5ba2\u6237\u7aef\u811a\u672c\u3002\u6211\u63d0\u4f9b\u4e86\u5c3d\u53ef\u80fd\u591a\u7684\u80cc\u666f\u4fe1\u606f\uff0c\u5e76\u63d0\u4f9b\u4e86\u6307\u5411\u60a8\u53ef\u4ee5\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u7684\u7f51\u7ad9\u548c\u4e66\u7c4d\u7684\u94fe\u63a5\u3002<\/p>\n<h3>How this book is organized<\/h3>\n<h3>\u672c\u4e66\u7684\u7ec4\u7ec7\u65b9\u5f0f<\/h3>\n<p>This book is divided into 5 parts, 36 chapters, and 2 appendices. Ideally, you will read the book cover to cover and then use it as a reference, but I realize that this approach won\u2019t suit everyone. Although I use small sample apps to demonstrate a topic, some chapters build on the work of previous ones, so the content will make more sense when read sequentially.<\/p>\n<p>\u672c\u4e66\u5206\u4e3a5\u4e2a\u90e8\u5206\u300136\u7ae0\u548c2\u4e2a\u9644\u5f55\u3002\u7406\u60f3\u60c5\u51b5\u4e0b\uff0c\u4f60\u4f1a\u4ece\u5934\u5230\u5c3e\u9605\u8bfb\u8fd9\u672c\u4e66\uff0c\u7136\u540e\u5c06\u5176\u7528\u4f5c\u53c2\u8003\uff0c\u4f46\u6211\u610f\u8bc6\u5230\u8fd9\u79cd\u65b9\u6cd5\u5e76\u4e0d\u9002\u5408\u6240\u6709\u4eba\u3002\u867d\u7136\u6211\u4f7f\u7528\u5c0f\u578b\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u6765\u6f14\u793a\u4e3b\u9898\uff0c\u4f46\u6709\u4e9b\u7ae0\u8282\u5efa\u7acb\u5728\u524d\u51e0\u7ae0\u7684\u57fa\u7840\u4e0a\uff0c\u56e0\u6b64\u6309\u987a\u5e8f\u9605\u8bfb\u65f6\uff0c\u5185\u5bb9\u4f1a\u66f4\u6709\u610f\u4e49\u3002<\/p>\n<p>I strongly suggest reading the chapters in part 1 in sequence, as each chapter builds on topics introduced in the previous chapters and provides a basis for the rest of the book. Part 2 is also best read sequentially, though most of the chapters are independent if you wish to jump around.<\/p>\n<p>\u6211\u5f3a\u70c8\u5efa\u8bae\u6309\u987a\u5e8f\u9605\u8bfb\u7b2c1\u90e8\u5206\u4e2d\u7684\u7ae0\u8282\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ae0\u90fd\u5efa\u7acb\u5728\u524d\u51e0\u7ae0\u4ecb\u7ecd\u7684\u4e3b\u9898\u4e4b\u4e0a\uff0c\u5e76\u4e3a\u672c\u4e66\u7684\u5176\u4f59\u90e8\u5206\u63d0\u4f9b\u4e86\u57fa\u7840\u3002\u7b2c2\u90e8\u5206\u4e5f\u6700\u597d\u6309\u987a\u5e8f\u9605\u8bfb\uff0c\u4f46\u5982\u679c\u60a8\u60f3\u8df3\u6765\u8df3\u53bb\uff0c\u5927\u591a\u6570\u7ae0\u8282\u90fd\u662f\u72ec\u7acb\u7684\u3002<\/p>\n<p>Part 3, again, is best read sequentially. You\u2019ll get the best experience by reading the chapters in parts 4 and 5 sequentially, but many of the topics are independent, so you can read them out of order if you prefer. But I recommend only doing so after you\u2019ve covered parts 1 to 3.<\/p>\n<p>\u540c\u6837\uff0c\u7b2c3\u90e8\u5206\u6700\u597d\u6309\u987a\u5e8f\u9605\u8bfb\u3002\u6309\u987a\u5e8f\u9605\u8bfb\u7b2c4\u90e8\u5206\u548c\u7b2c5\u90e8\u5206\u4e2d\u7684\u7ae0\u8282\u5c06\u83b7\u5f97\u6700\u4f73\u4f53\u9a8c\uff0c\u4f46\u8bb8\u591a\u4e3b\u9898\u662f\u72ec\u7acb\u7684\uff0c\u56e0\u6b64\u5982\u679c\u60a8\u613f\u610f\uff0c\u53ef\u4ee5\u4e0d\u6309\u987a\u5e8f\u9605\u8bfb\u5b83\u4eec\u3002\u4f46\u6211\u5efa\u8bae\u4ec5\u5728\u60a8\u5b8c\u6210\u7b2c1\u90e8\u5206\u5230\u7b2c3\u90e8\u5206\u540e\u624d\u8fd9\u6837\u505a\u3002<\/p>\n<p>Part 1 provides a general introduction to ASP.NET Core, focusing on building small JSON APIs by using the latest features introduced in .NET 7. After we cover the basics, we look at building minimal API applications that provide the simplest programming model for ASP.NET Core web applications.<\/p>\n<p>\u7b2c1\u90e8\u5206\u63d0\u4f9b\u4e86ASP.NET Core\u7684\u4e00\u822c\u4ecb\u7ecd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528.NET7\u4e2d\u5f15\u5165\u7684\u6700\u65b0\u529f\u80fd\u6784\u5efa\u5c0f\u578bJSONAPI\u3002\u5728\u4ecb\u7ecd\u57fa\u7840\u77e5\u8bc6\u4e4b\u540e\uff0c\u6211\u4eec\u5c06\u4e86\u89e3\u5982\u4f55\u6784\u5efa\u6700\u5c0f\u7684API\u5e94\u7528\u7a0b\u5e8f\uff0c\u8fd9\u4e9b\u5e94\u7528\u7a0b\u5e8f\u4e3aASP.NETCoreWeb\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u6700\u7b80\u5355\u7684\u7f16\u7a0b\u6a21\u578b\u3002<\/p>\n<ul>\n<li>\n<p>Chapter 1 introduces ASP.NET Core and its place in the web development landscape. It describes the type of applications you can build, some of the reasons to choose ASP.NET Core, and the basics of web requests in an ASP.NET Core application.<\/p>\n<\/li>\n<li>\n<p>\u7b2c1\u7ae0\u4ecb\u7ecd\u4e86ASP.NETCore\u53ca\u5176\u5728Web\u5f00\u53d1\u9886\u57df\u4e2d\u7684\u5730\u4f4d\u3002\u5b83\u4ecb\u7ecd\u4e86\u60a8\u53ef\u4ee5\u6784\u5efa\u7684\u5e94\u7528\u7a0b\u5e8f\u7c7b\u578b\u3001\u9009\u62e9ASP.NETCore\u7684\u4e00\u4e9b\u539f\u56e0\uff0c\u4ee5\u53caASP.NET Core\u5e94\u7528\u7a0b\u5e8f\u4e2dWeb\u8bf7\u6c42\u7684\u57fa\u7840\u77e5\u8bc6\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 2 looks at why you should consider using any web framework, why ASP.NET Core was created, and the di\ufb00erent application paradigms you can use with ASP.NET Core. Finally, it looks at the situations when you should and shouldn\u2019t choose ASP.NET Core.<\/p>\n<\/li>\n<li>\n<p>\u7b2c2\u7ae0\u63a2\u8ba8\u4e86\u4e3a\u4ec0\u4e48\u5e94\u8be5\u8003\u8651\u4f7f\u7528\u4efb\u4f55Web\u6846\u67b6\uff0c\u521b\u5efaASP.NETCore\u7684\u539f\u56e0\uff0c\u4ee5\u53ca\u53ef\u4ee5\u4e0eASP.NET Core\u4e00\u8d77\u4f7f\u7528\u7684\u4e0d\u540c\u5e94\u7528\u7a0b\u5e8f\u8303\u4f8b\u3002\u6700\u540e\uff0c\u5b83\u7740\u773c\u4e8e\u60a8\u5e94\u8be5\u548c\u4e0d\u5e94\u8be5\u9009\u62e9ASP.NET Core\u7684\u60c5\u51b5\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 3 walks through all the components of a basic ASP.NET Core minimal API application, discussing their role and how they combine to generate a response to a web request.<\/p>\n<\/li>\n<li>\n<p>\u7b2c3\u7ae0\u4ecb\u7ecd\u4e86\u57fa\u672cASP.NET Core\u6700\u5c0fAPI\u5e94\u7528\u7a0b\u5e8f\u7684\u6240\u6709\u7ec4\u4ef6\uff0c\u8ba8\u8bba\u4e86\u5b83\u4eec\u7684\u4f5c\u7528\u4ee5\u53ca\u5b83\u4eec\u5982\u4f55\u7ec4\u5408\u4ee5\u751f\u6210\u5bf9Web\u8bf7\u6c42\u7684\u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 4 describes the middleware pipeline, the main application pipeline in ASP.NET Core, which de\ufb01nes how incoming requests are processed and how a response should be generated.<\/p>\n<\/li>\n<li>\n<p>\u7b2c4\u7ae0\u4ecb\u7ecd\u4e86\u4e2d\u95f4\u4ef6\u7ba1\u9053\uff0c\u8fd9\u662fASP.NET Core\u4e2d\u7684\u4e3b\u8981\u5e94\u7528\u7a0b\u5e8f\u7ba1\u9053\uff0c\u5b83\u5b9a\u4e49\u4e86\u5982\u4f55\u5904\u7406\u4f20\u5165\u8bf7\u6c42\u4ee5\u53ca\u5982\u4f55\u751f\u6210\u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 5 shows how to use minimal API endpoints to create a JavaScript Object Notation (JSON) HTTP API that can be called by client-side apps, server-side apps, or mobile devices.<\/p>\n<\/li>\n<li>\n<p>\u7b2c5\u7ae0\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528\u6700\u5c11\u7684API\u7aef\u70b9\u6765\u521b\u5efa\u53ef\u7531\u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3001\u670d\u52a1\u5668\u7aef\u5e94\u7528\u7a0b\u5e8f\u6216\u79fb\u52a8\u8bbe\u5907\u8c03\u7528\u7684JavaScript\u5bf9\u8c61\u8868\u793a\u6cd5\uff08JSON\uff09HTTP API<\/p>\n<\/li>\n<li>\n<p>Chapter 6 describes the ASP.NET Core routing system. Routing is the process of mapping incoming request URLs to a speci\ufb01c handler method, which executes to generate a response.<\/p>\n<\/li>\n<li>\n<p>\u7b2c6\u7ae0\u4ecb\u7ecd\u4e86ASP.NET Core\u8def\u7531\u7cfb\u7edf\u3002\u8def\u7531\u662f\u5c06\u4f20\u5165\u8bf7\u6c42URL\u6620\u5c04\u5230\u7279\u5b9a\u5904\u7406\u7a0b\u5e8f\u65b9\u6cd5\u7684\u8fc7\u7a0b\uff0c\u8be5\u65b9\u6cd5\u6267\u884c\u4ee5\u751f\u6210\u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 7 looks at model binding in minimal APIs, the process of mapping form data and URL parameters passed in a request to concrete C# objects.<\/p>\n<\/li>\n<li>\n<p>\u7b2c7\u7ae0\u7740\u773c\u4e8e\u6700\u5c0fAPI\u4e2d\u7684\u6a21\u578b\u7ed1\u5b9a\uff0c\u4ee5\u53ca\u5c06\u8bf7\u6c42\u4e2d\u4f20\u9012\u7684\u8868\u5355\u6570\u636e\u548cURL\u53c2\u6570\u6620\u5c04\u5230\u5177\u4f53C#\u5bf9\u8c61\u7684\u8fc7\u7a0b\u3002<\/p>\n<\/li>\n<\/ul>\n<p>Part 2 covers important topics for building fully-featured web applications after you understand the basics:<\/p>\n<p>\u5728\u4e86\u89e3\u4e86\u57fa\u7840\u77e5\u8bc6\u4e4b\u540e\uff0c\u7b2c2\u90e8\u5206\u5c06\u4ecb\u7ecd\u6784\u5efa\u529f\u80fd\u9f50\u5168\u7684Web\u5e94\u7528\u7a0b\u5e8f\u7684\u91cd\u8981\u4e3b\u9898\uff1a<\/p>\n<ul>\n<li>\n<p>Chapter 8 introduces the concept of dependency injection (DI) and describes the DI container built into ASP.NET Core.<\/p>\n<\/li>\n<li>\n<p>\u7b2c8\u7ae0\u4ecb\u7ecd\u4e86\u4f9d\u8d56\u5173\u7cfb\u6ce8\u5165\uff08DI\uff09\u7684\u6982\u5ff5\uff0c\u5e76\u4ecb\u7ecd\u4e86ASP.NETCore\u4e2d\u5185\u7f6e\u7684DI\u5bb9\u5668\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 9 builds on chapter 8 by describing how to register your own services with the DI container, the patterns you can use, and how to understand the lifetime of services the DI container creates.<\/p>\n<\/li>\n<li>\n<p>\u7b2c9\u7ae0\u4ee5\u7b2c8\u7ae0\u4e3a\u57fa\u7840\uff0c\u4ecb\u7ecd\u4e86\u5982\u4f55\u5411DI\u5bb9\u5668\u6ce8\u518c\u60a8\u81ea\u5df1\u7684\u670d\u52a1\u3001\u60a8\u53ef\u4ee5\u4f7f\u7528\u7684\u6a21\u5f0f\u4ee5\u53ca\u5982\u4f55\u4e86\u89e3DI\u5bb9\u5668\u521b\u5efa\u7684\u670d\u52a1\u7684\u751f\u547d\u5468\u671f\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 10 discusses how to read settings and secrets in ASP.NET Core, and how to map them to strongly typed objects.<\/p>\n<\/li>\n<li>\n<p>\u7b2c10\u7ae0\u8ba8\u8bba\u4e86\u5982\u4f55\u8bfb\u53d6ASP.NET Core\u4e2d\u7684\u8bbe\u7f6e\u548c\u5bc6\u94a5\uff0c\u4ee5\u53ca\u5982\u4f55\u5c06\u5b83\u4eec\u6620\u5c04\u5230\u5f3a\u7c7b\u578b\u5bf9\u8c61\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 11 describes how to document your APIs using the OpenAPI standard and how this helps with testing scenarios and for automatically generating clients to call your APIs.<\/p>\n<\/li>\n<li>\n<p>\u7b2c11\u7ae0\u63cf\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528OpenAPI\u6807\u51c6\u8bb0\u5f55\u60a8\u7684API\uff0c\u4ee5\u53ca\u5b83\u5982\u4f55\u5e2e\u52a9\u6d4b\u8bd5\u573a\u666f\u548c\u81ea\u52a8\u751f\u6210\u5ba2\u6237\u7aef\u6765\u8c03\u7528API\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 12 introduces EntityFramework Core (EF Core) for saving data in a relational database.<\/p>\n<\/li>\n<li>\n<p>\u7b2c12\u7ae0\u4ecb\u7ecd\u4e86\u7528\u4e8e\u5728\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\u4fdd\u5b58\u6570\u636e\u7684EntityFramework Core\uff08EFCore\uff09\u3002<\/p>\n<\/li>\n<\/ul>\n<p>Part 3 moves away from minimal APIs and looks at how to build server-rendered page-based HTML applications using Razor Pages and the Model-View-Controller (MVC) architecture:<\/p>\n<p>\u7b2c3\u90e8\u5206\u4ece\u6700\u5c11\u7684API\u51fa\u53d1\uff0c\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528RazorPages\u548c\u6a21\u578b-\u89c6\u56fe-\u63a7\u5236\u5668\uff08MVC\uff09\u4f53\u7cfb\u7ed3\u6784\u6784\u5efa\u670d\u52a1\u5668\u5448\u73b0\u7684\u57fa\u4e8e\u9875\u9762\u7684HTML\u5e94\u7528\u7a0b\u5e8f\uff1a<\/p>\n<ul>\n<li>\n<p>Chapter 13 shows how to use Razor Pages to build page-based web sites. Razor Pages are the recommended way to build server-rendered applications in ASP.NET Core and are designed for page-based applications.<\/p>\n<\/li>\n<li>\n<p>\u7b2c13\u7ae0\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528RazorPages\u6784\u5efa\u57fa\u4e8e\u9875\u9762\u7684\u7f51\u7ad9\u3002RazorPages\u662f\u5728ASP.NET Core\u4e2d\u6784\u5efa\u670d\u52a1\u5668\u5448\u73b0\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u63a8\u8350\u65b9\u6cd5\uff0c\u4e13\u4e3a\u57fa\u4e8e\u9875\u9762\u7684\u5e94\u7528\u7a0b\u5e8f\u800c\u8bbe\u8ba1\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 14 describes the Razor Pages routing system and how it di\ufb00ers from minimal APIs.<\/p>\n<\/li>\n<li>\n<p>\u7b2c14\u7ae0\u4ecb\u7ecd\u4e86RazorPages\u8def\u7531\u7cfb\u7edf\u4ee5\u53ca\u5b83\u4e0e\u6700\u5c0fAPI\u7684\u533a\u522b\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 15 looks at page handlers in Razor Pages, which are responsible for choosing how to respond to a request and selecting what response to generate.<\/p>\n<\/li>\n<li>\n<p>\u7b2c15\u7ae0\u4ecb\u7ecd\u4e86RazorPages\u4e2d\u7684\u9875\u9762\u5904\u7406\u7a0b\u5e8f\uff0c\u8fd9\u4e9b\u5904\u7406\u7a0b\u5e8f\u8d1f\u8d23\u9009\u62e9\u5982\u4f55\u54cd\u5e94\u8bf7\u6c42\u5e76\u9009\u62e9\u8981\u751f\u6210\u7684\u54cd\u5e94\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 16 looks at model binding in Razor Pages, how it di\ufb00ers from minimal APIs, and the importance of validating your models.<\/p>\n<\/li>\n<li>\n<p>\u7b2c16\u7ae0\u4ecb\u7ecd\u4e86RazorPages\u4e2d\u7684\u6a21\u578b\u7ed1\u5b9a\u3001\u5b83\u4e0e\u6700\u5c0fAPI\u7684\u533a\u522b\uff0c\u4ee5\u53ca\u9a8c\u8bc1\u6a21\u578b\u7684\u91cd\u8981\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 17 shows how to generate HTML web pages using the Razor template language.<\/p>\n<\/li>\n<li>\n<p>\u7b2c17\u7ae0\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528Razor\u6a21\u677f\u8bed\u8a00\u751f\u6210HTML\u7f51\u9875\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 18 builds on chapter 17 by introducing Tag Helpers, which can greatly reduce the amount of code required to build forms and web pages.<\/p>\n<\/li>\n<li>\n<p>\u7b2c18\u7ae0\u5728\u7b2c17\u7ae0\u7684\u57fa\u7840\u4e0a\u5f15\u5165\u4e86\u6807\u8bb0\u5e2e\u52a9\u7a0b\u5e8f\uff0c\u8fd9\u53ef\u4ee5\u5927\u5927\u51cf\u5c11\u6784\u5efa\u8868\u5355\u548c\u7f51\u9875\u6240\u9700\u7684\u4ee3\u7801\u91cf\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 19 introduces MVC controllers as an alternative approach to building both server- rendered HTML applications and API applications.<\/p>\n<\/li>\n<li>\n<p>\u7b2c19\u7ae0\u4ecb\u7ecd\u4e86MVC\u63a7\u5236\u5668\u4f5c\u4e3a\u6784\u5efa\u670d\u52a1\u5668\u6e32\u67d3\u7684HTML\u5e94\u7528\u7a0b\u5e8f\u548cAPI\u5e94\u7528\u7a0b\u5e8f\u7684\u66ff\u4ee3\u65b9\u6cd5\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 20 describes how to use MVC controllers to build APIs that can be called by client-side apps as an alternative to minimal APIs.<\/p>\n<\/li>\n<li>\n<p>\u7b2c20\u7ae0\u63cf\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528MVC\u63a7\u5236\u5668\u6784\u5efa\u53ef\u7531\u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u8c03\u7528\u7684API\uff0c\u4f5c\u4e3a\u6700\u5c0fAPI\u7684\u66ff\u4ee3\u65b9\u6848\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 21 introduces the MVC and Razor Pages \ufb01lter pipeline, shows how it works, and describes some of the \ufb01lters built into the framework.<\/p>\n<\/li>\n<li>\n<p>\u7b2c21\u7ae0\u4ecb\u7ecd\u4e86MVC\u548cRazorPages\u7b5b\u9009\u5668\u7ba1\u9053\uff0c\u5c55\u793a\u4e86\u5b83\u7684\u5de5\u4f5c\u539f\u7406\uff0c\u5e76\u4ecb\u7ecd\u4e86\u6846\u67b6\u4e2d\u5185\u7f6e\u7684\u4e00\u4e9b\u7b5b\u9009\u5668\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 22 builds on chapter 21 by showing how to create custom \ufb01lters to reduce some of the duplication in your MVC and Razor Pages applications.<\/p>\n<\/li>\n<li>\n<p>\u7b2c22\u7ae0\u4ee5\u7b2c21\u7ae0\u4e3a\u57fa\u7840\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u521b\u5efa\u81ea\u5b9a\u4e49\u7b5b\u9009\u5668\u4ee5\u51cf\u5c11MVC\u548cRazorPages\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u4e00\u4e9b\u91cd\u590d\u3002<\/p>\n<\/li>\n<\/ul>\n<p>The chapters that make up part 4 cover important cross- cutting aspects of ASP.NET Core development:<\/p>\n<p>\u6784\u6210\u7b2c4\u90e8\u5206\u7684\u7ae0\u8282\u6db5\u76d6\u4e86ASP.NETCore\u5f00\u53d1\u7684\u91cd\u8981\u8de8\u9886\u57df\u65b9\u9762\uff1a<\/p>\n<ul>\n<li>\n<p>Chapter 23 describes how to add user pro\ufb01les and authentication to your application by using ASP.NET Core Identity.<\/p>\n<\/li>\n<li>\n<p>\u7b2c23\u7ae0\u63cf\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528ASP.NETCoreIdentity\u5411\u5e94\u7528\u7a0b\u5e8f\u6dfb\u52a0\u7528\u6237\u914d\u7f6e\u6587\u4ef6\u548c\u8eab\u4efd\u9a8c\u8bc1\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 24 builds on the previous chapter by introducing authorization for users so you can restrict which pages a signed-in user can access.<\/p>\n<\/li>\n<li>\n<p>\u7b2c24\u7ae0\u5728\u4e0a\u4e00\u7ae0\u7684\u57fa\u7840\u4e0a\u5f15\u5165\u4e86\u7528\u6237\u6388\u6743\uff0c\u4ee5\u4fbf\u60a8\u53ef\u4ee5\u9650\u5236\u5df2\u767b\u5f55\u7528\u6237\u53ef\u4ee5\u8bbf\u95ee\u7684\u9875\u9762\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 25 discusses authentication and authorization for API applications, how this di\ufb00ers from authentication in HTML applications, and how to get started with authentication in ASP.NET Core APIs.<\/p>\n<\/li>\n<li>\n<p>\u7b2c25\u7ae0\u8ba8\u8bba\u4e86API\u5e94\u7528\u7a0b\u5e8f\u7684\u8eab\u4efd\u9a8c\u8bc1\u548c\u6388\u6743\uff0c\u8fd9\u4e0eHTML\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u8eab\u4efd\u9a8c\u8bc1\u6709\u4f55\u4e0d\u540c\uff0c\u4ee5\u53ca\u5982\u4f55\u5f00\u59cb\u5728ASP.NET Core API\u4e2d\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 26 shows how to con\ufb01gure logging in your application and how to write log messages to multiple locations.<\/p>\n<\/li>\n<li>\n<p>\u7b2c26\u7ae0\u5c55\u793a\u4e86\u5982\u4f55\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u914d\u7f6e\u65e5\u5fd7\u8bb0\u5f55\u4ee5\u53ca\u5982\u4f55\u5c06\u65e5\u5fd7\u6d88\u606f\u5199\u5165\u591a\u4e2a\u4f4d\u7f6e\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 27 looks at how to publish your app and con\ufb01gure it for a production environment.<\/p>\n<\/li>\n<li>\n<p>\u7b2c27\u7ae0\u4ecb\u7ecd\u4e86\u5982\u4f55\u53d1\u5e03\u5e94\u7528\u7a0b\u5e8f\u5e76\u9488\u5bf9\u751f\u4ea7\u73af\u5883\u5bf9\u5176\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 28 discusses the reason for adding HTTPS to your application, how to use HTTPS when developing locally and in production, and how to force HTTPS for your whole application.<\/p>\n<\/li>\n<li>\n<p>\u7b2c28\u7ae0\u8ba8\u8bba\u4e86\u5c06HTTPS\u6dfb\u52a0\u5230\u5e94\u7528\u7a0b\u5e8f\u7684\u539f\u56e0\uff0c\u5728\u672c\u5730\u548c\u751f\u4ea7\u73af\u5883\u4e2d\u5f00\u53d1\u65f6\u5982\u4f55\u4f7f\u7528HTTPS\uff0c\u4ee5\u53ca\u5982\u4f55\u4e3a\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u5f3a\u5236\u4f7f\u7528HTTPS\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 29 explores some other security considerations you should make when developing your application and how to stay safe with ASP.NET Core.<\/p>\n<\/li>\n<li>\n<p>\u7b2c29\u7ae0\u63a2\u8ba8\u4e86\u5728\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u65f6\u5e94\u8003\u8651\u7684\u5176\u4ed6\u4e00\u4e9b\u5b89\u5168\u6ce8\u610f\u4e8b\u9879\uff0c\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528ASP.NETCore\u4fdd\u6301\u5b89\u5168\u3002<\/p>\n<\/li>\n<\/ul>\n<p>Part 5 looks at various topics that help you take your ASP.NET Core applications further, including nonweb applications, custom con\ufb01guration and components, and testing:<\/p>\n<p>\u7b2c5\u90e8\u5206\u5c06\u4ecb\u7ecd\u5404\u79cd\u4e3b\u9898\uff0c\u8fd9\u4e9b\u4e3b\u9898\u53ef\u5e2e\u52a9\u60a8\u8fdb\u4e00\u6b65\u6539\u8fdbASP.NETCore\u5e94\u7528\u7a0b\u5e8f\uff0c\u5305\u62ec\u975eWeb\u5e94\u7528\u7a0b\u5e8f\u3001\u81ea\u5b9a\u4e49\u914d\u7f6e\u548c\u7ec4\u4ef6\u4ee5\u53ca\u6d4b\u8bd5\uff1a<\/p>\n<ul>\n<li>\n<p>Chapter 30 discusses an alternative bootstrapping approach for ASP.NET Core apps, using the generic host and a Startup class.<\/p>\n<\/li>\n<li>\n<p>\u7b2c30\u7ae0\u8ba8\u8bba\u4e86ASP.NETCore\u5e94\u7528\u7a0b\u5e8f\u7684\u53e6\u4e00\u79cd\u5f15\u5bfc\u65b9\u6cd5\uff0c\u4f7f\u7528\u901a\u7528host\u548cStartup\u7c7b\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 31 describes how to build and use a variety of custom components, such as custom middleware, and how to handle complex con\ufb01guration requirements.<\/p>\n<\/li>\n<li>\n<p>\u7b2c31\u7ae0\u63cf\u8ff0\u4e86\u5982\u4f55\u6784\u5efa\u548c\u4f7f\u7528\u5404\u79cd\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u4f8b\u5982\u81ea\u5b9a\u4e49\u4e2d\u95f4\u4ef6\uff0c\u4ee5\u53ca\u5982\u4f55\u5904\u7406\u590d\u6742\u7684\u914d\u7f6e\u8981\u6c42\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 32 expands on chapter 31, showing how to build custom Razor Page components such as custom Tag Helpers and custom validation attributes.<\/p>\n<\/li>\n<li>\n<p>\u7b2c32\u7ae0\u5bf9\u7b2c31\u7ae0\u8fdb\u884c\u4e86\u6269\u5c55\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u6784\u5efa\u81ea\u5b9a\u4e49Razor\u9875\u9762\u7ec4\u4ef6\uff0c\u4f8b\u5982\u81ea\u5b9a\u4e49\u6807\u8bb0\u5e2e\u52a9\u7a0b\u5e8f\u548c\u81ea\u5b9a\u4e49\u9a8c\u8bc1\u5c5e\u6027\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 33 discusses the IHttpClientFactory service and how to use it to create HttpClient instances for calling remote APIs.<\/p>\n<\/li>\n<li>\n<p>\u7b2c33\u7ae0\u8ba8\u8bba\u4e86IHttpClientFactory\u670d\u52a1\u4ee5\u53ca\u5982\u4f55\u4f7f\u7528\u5b83\u6765\u521b\u5efa\u7528\u4e8e\u8c03\u7528\u8fdc\u7a0bAPI\u7684HttpClient\u5b9e\u4f8b\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 34 explores the generic IHost abstraction, which you can use to create Windows Services and Linux daemons. You\u2019ll also learn to run tasks in the background of your applications.<\/p>\n<\/li>\n<li>\n<p>\u7b2c34\u7ae0\u63a2\u8ba8\u4e86\u901a\u7528\u7684IHost\u62bd\u8c61\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u521b\u5efaWindows\u670d\u52a1\u548cLinux\u5b88\u62a4\u7a0b\u5e8f\u3002\u60a8\u8fd8\u5c06\u5b66\u4e60\u5982\u4f55\u5728\u5e94\u7528\u7a0b\u5e8f\u7684\u540e\u53f0\u8fd0\u884c\u4efb\u52a1\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 35 shows how to test an ASP.NET Core application with the xUnit testing framework.<\/p>\n<\/li>\n<li>\n<p>\u7b2c35\u7ae0\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528xUnit\u6d4b\u8bd5\u6846\u67b6\u6d4b\u8bd5ASP.NET Core\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<\/li>\n<li>\n<p>Chapter 36 follows on from chapter 35, showing how to test ASP.NET Core applications speci\ufb01cally. It covers both unit tests and integration tests using the Test Host.<\/p>\n<\/li>\n<li>\n<p>\u7b2c36\u7ae0\u662f\u7b2c35\u7ae0\u7684\u540e\u7eed\u5185\u5bb9\uff0c\u4e13\u95e8\u5c55\u793a\u4e86\u5982\u4f55\u6d4b\u8bd5ASP.NET Core\u5e94\u7528\u7a0b\u5e8f\u3002\u5b83\u6db5\u76d6\u5355\u5143\u6d4b\u8bd5\u548c\u4f7f\u7528TestHost\u7684\u96c6\u6210\u6d4b\u8bd5\u3002<\/p>\n<\/li>\n<\/ul>\n<p>The two appendices provide supplementary information:<\/p>\n<p>\u4e24\u4e2a\u9644\u5f55\u63d0\u4f9b\u4e86\u8865\u5145\u4fe1\u606f\uff1a<\/p>\n<ul>\n<li>\n<p>Appendix A describes how to con\ufb01gure your development environment, whether you\u2019re in Windows, Linux, or macOS.<\/p>\n<\/li>\n<li>\n<p>\u9644\u5f55A\u4ecb\u7ecd\u4e86\u5982\u4f55\u914d\u7f6e\u5f00\u53d1\u73af\u5883\uff0c\u65e0\u8bba\u60a8\u4f7f\u7528\u7684\u662fWindows\u3001Linux\u8fd8\u662fmacOS\u3002<\/p>\n<\/li>\n<li>\n<p>Appendix B contains links that I\u2019ve found useful in learning about ASP.NET Core.<\/p>\n<\/li>\n<li>\n<p>\u9644\u5f55B\u5305\u542b\u6211\u53d1\u73b0\u5bf9\u4e86\u89e3ASP.NETCore\u6709\u7528\u7684\u94fe\u63a5\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>About the code<\/h3>\n<h3>\u5173\u4e8e\u4ee3\u7801<\/h3>\n<p>Source code is provided for all chapters except chapters 1, 2, 21, and 27, which don\u2019t have any code. You can view the source code for each chapter in my GitHub repository at <a href=\"https:\/\/github.com\/andrewlock\/asp-dot-net-core-in-action-3e\">https:\/\/github.com\/andrewlock\/asp-dot-net-core-in-action-3e<\/a>. A zip \ufb01le containing all the source code is also available on the publisher\u2019s website at <a href=\"https:\/\/www.manning.com\/books\/asp-net-core-in-action-third-edition\">https:\/\/www.manning.com\/books\/asp-net-core-in-action-third-edition<\/a>. You can get executable snippets of code from the liveBook (online) version of this book at <a href=\"https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\">https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition<\/a>.<\/p>\n<p>\u9664\u4e86\u7b2c1\u30012\u300121\u548c27\u7ae0\u4e4b\u5916\uff0c\u6240\u6709\u7ae0\u8282\u90fd\u63d0\u4f9b\u4e86\u6e90\u4ee3\u7801\uff0c\u5b83\u4eec\u6ca1\u6709\u4efb\u4f55\u4ee3\u7801\u3002\u60a8\u53ef\u4ee5\u5728https:\/\/github.com\/andrewlock\/asp-dot-net-core-in-action-3e \u7684\u6211\u7684GitHub\u5b58\u50a8\u5e93\u4e2d\u67e5\u770b\u6bcf\u7ae0\u7684\u6e90\u4ee3\u7801\u3002\u51fa\u7248\u5546\u7684\u7f51\u7ad9\u4e0a\u4e5f\u63d0\u4f9b\u4e86\u5305\u542b\u6240\u6709\u6e90\u4ee3\u7801\u7684zip\u6587\u4ef6\uff0c\u7f51\u5740\u4e3ahttps:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\u3002\u60a8\u53ef\u4ee5\u4ece\u672c\u4e66\u7684liveBook\uff08\u5728\u7ebf\uff09\u7248\u672c\uff08<a href=\"https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\">https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition<\/a> \uff09\u83b7\u53d6\u53ef\u6267\u884c\u7684\u4ee3\u7801\u7247\u6bb5\u3002<\/p>\n<p>All the code examples in this book use .NET 7 and were built using both Visual Studio and Visual Studio Code. To build and run the examples, you need to install the .NET software development kit (SDK), as described in appendix A.<\/p>\n<p>\u672c\u4e66\u4e2d\u7684\u6240\u6709\u4ee3\u7801\u793a\u4f8b\u90fd\u4f7f\u7528.NET7\uff0c\u5e76\u4e14\u662f\u4f7f\u7528VisualStudio\u548cVisualStudio Code\u6784\u5efa\u7684\u3002\u6784\u5efa\u5e76\u8fd0\u884c\u793a\u4f8b\uff0c\u60a8\u9700\u8981\u5b89\u88c5.NET\u8f6f\u4ef6\u5f00\u53d1\u5de5\u5177\u5305\uff08SDK\uff09\uff0c\u5982\u9644\u5f55A\u4e2d\u6240\u8ff0\u3002<\/p>\n<p>This book contains many examples of source code, both in numbered listings and inline with normal text. In both cases, source code is formatted in a fixed-width font like this to separate it from ordinary text. Sometimes code is also in bold to highlight changes from previous steps in the chapter, such as when a new feature adds to an existing line of code.<\/p>\n<p>\u672c\u4e66\u5305\u542b\u8bb8\u591a\u6e90\u4ee3\u7801\u793a\u4f8b\uff0c\u5305\u62ec\u7f16\u53f7\u5217\u8868\u548c\u4e0e\u666e\u901a\u6587\u672c\u5185\u8054\u7684\u6e90\u4ee3\u7801\u3002\u5728\u8fd9\u4e24\u79cd\u60c5\u51b5\u4e0b\uff0c\u6e90\u4ee3\u7801\u90fd\u91c7\u7528\u56fa\u5b9a\u5bbd\u5ea6\u5b57\u4f53\u7684\u683c\u5f0f\uff0c\u4ee5\u4fbf\u5c06\u5176\u4e0e\u666e\u901a\u6587\u672c\u533a\u5206\u5f00\u6765\u3002\u6709\u65f6\uff0c\u4ee3\u7801\u4e5f\u4ee5\u7c97\u4f53\u663e\u793a\uff0c\u4ee5\u7a81\u51fa\u663e\u793a\u4e0e\u672c\u7ae0\u4e2d\u524d\u9762\u6b65\u9aa4\u76f8\u6bd4\u7684\u66f4\u6539\uff0c\u4f8b\u5982\uff0c\u5f53\u65b0\u529f\u80fd\u6dfb\u52a0\u5230\u73b0\u6709\u4ee3\u7801\u884c\u65f6\u3002<\/p>\n<p>In many cases, the original source code has been reformatted; we\u2019ve added line breaks and reworked indentation to accommodate the available page space in the book. In rare cases, even this was not enough, and some listings include line-continuation markers (\u27a5).<\/p>\n<p>\u5728\u8bb8\u591a\u60c5\u51b5\u4e0b\uff0c\u539f\u59cb\u6e90\u4ee3\u7801\u5df2\u88ab\u91cd\u65b0\u683c\u5f0f\u5316;\u6211\u4eec\u6dfb\u52a0\u4e86\u6362\u884c\u7b26\u5e76\u91cd\u65b0\u8bbe\u8ba1\u4e86\u7f29\u8fdb\uff0c\u4ee5\u9002\u5e94\u4e66\u7c4d\u4e2d\u53ef\u7528\u7684\u9875\u9762\u7a7a\u95f4\u3002\u5728\u6781\u5c11\u6570\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7f\u8fd9\u6837\u8fd8\u4e0d\u591f\uff0c\u4e00\u4e9b\u5546\u54c1\u4fe1\u606f\u5305\u542b\u884c\u7ee7\u7eed\u6807\u8bb0\uff08\u27a5\uff09\u3002<\/p>\n<p>Additionally, comments in the source code have been removed from the listings when the code is described in the text. Code annotations accompany many of the listings, highlighting important concepts.<\/p>\n<p>\u6b64\u5916\uff0c\u5f53\u6587\u672c\u4e2d\u63cf\u8ff0\u4ee3\u7801\u65f6\uff0c\u6e90\u4ee3\u7801\u4e2d\u7684\u6ce8\u91ca\u5df2\u4ece\u5217\u8868\u4e2d\u5220\u9664\u3002\u8bb8\u591a\u6e05\u5355\u90fd\u9644\u6709\u4ee3\u7801\u6ce8\u91ca\uff0c\u7a81\u51fa\u4e86\u91cd\u8981\u7684\u6982\u5ff5\u3002<\/p>\n<h3>liveBook discussion forum<\/h3>\n<h3>liveBook\u8bba\u575b<\/h3>\n<p>Purchase of ASP.NET Core in Action, Third Edition, includes free access to liveBook, Manning\u2019s online reading platform. Using liveBook\u2019s exclusive discussion features, you can attach comments to the book globally or to speci\ufb01c sections or paragraphs. It\u2019s a snap to make notes for yourself, ask and answer technical questions, and receive help from the author and other users. To access the forum, go to <a href=\"https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\/discussion\">https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\/discussion<\/a>. You can also learn more about Manning\u2019s forums and the rules of conduct at <a href=\"https:\/\/livebook.manning.com\/discussion\">https:\/\/livebook.manning.com\/discussion<\/a>.<\/p>\n<p>\u8d2d\u4e70ASP.NET Corein Action\uff0cThirdEdition\uff0c\u5373\u53ef\u514d\u8d39\u8bbf\u95eeManning\u7684\u5728\u7ebf\u9605\u8bfb\u5e73\u53f0liveBook\u3002\u4f7f\u7528liveBook\u7684\u72ec\u6709\u8ba8\u8bba\u529f\u80fd\uff0c\u60a8\u53ef\u4ee5\u5c06\u8bc4\u8bba\u5168\u5c40\u9644\u52a0\u5230\u4e66\u7c4d\u6216\u7279\u5b9a\u90e8\u5206\u6216\u6bb5\u843d\u3002\u60a8\u53ef\u4ee5\u4e3a\u81ea\u5df1\u505a\u7b14\u8bb0\uff0c\u63d0\u51fa\u548c\u56de\u7b54\u6280\u672f\u95ee\u9898\uff0c\u5e76\u4ece\u4f5c\u8005\u548c\u5176\u4ed6\u7528\u6237\u90a3\u91cc\u83b7\u5f97\u5e2e\u52a9\u3002\u8981\u8bbf\u95ee\u8bba\u575b\uff0c\u8bf7\u8f6c\u5230https:\/\/livebook.manning.com\/book\/asp-net-core-in-action-third-edition\/discussion\u3002\u60a8\u8fd8\u53ef\u4ee5\u5728https:\/\/livebook.manning.com\/discussion\u4e0a\u4e86\u89e3\u6709\u5173Manning\u8bba\u575b\u548c\u884c\u4e3a\u51c6\u5219\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p>Manning\u2019s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It is not a commitment to any speci\ufb01c amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest that you try asking the author some challenging questions lest his interest stray!<\/p>\n<p>\u66fc\u5b81\u5bf9\u8bfb\u8005\u7684\u627f\u8bfa\u662f\u63d0\u4f9b\u4e00\u4e2a\u573a\u6240\uff0c\u8ba9\u8bfb\u8005\u4e2a\u4eba\u4e4b\u95f4\u4ee5\u53ca\u8bfb\u8005\u4e0e\u4f5c\u8005\u4e4b\u95f4\u53ef\u4ee5\u8fdb\u884c\u6709\u610f\u4e49\u7684\u5bf9\u8bdd\u3002\u8fd9\u5e76\u4e0d\u662f\u4f5c\u8005\u5bf9\u4efb\u4f55\u7279\u5b9a\u53c2\u4e0e\u91cf\u7684\u627f\u8bfa\uff0c\u4ed6\u5bf9\u8bba\u575b\u7684\u8d21\u732e\u4ecd\u7136\u662f\u81ea\u613f\u7684\uff08\u5e76\u4e14\u662f\u65e0\u507f\u7684\uff09\u3002\u6211\u4eec\u5efa\u8bae\u60a8\u5c1d\u8bd5\u5411\u4f5c\u8005\u8be2\u95ee\u4e00\u4e9b\u5177\u6709\u6311\u6218\u6027\u7684\u95ee\u9898\uff0c\u4ee5\u514d\u4ed6\u7684\u5174\u8da3\u504f\u79bb\uff01<\/p>\n<p>The forum and the archives of previous discussions will be accessible on the publisher\u2019s website as long as the book is in print.<\/p>\n<p>\u53ea\u8981\u8fd9\u672c\u4e66\u662f\u5370\u5237\u7684\uff0c\u5c31\u53ef\u4ee5\u5728\u51fa\u7248\u5546\u7684\u7f51\u7ad9\u4e0a\u8bbf\u95ee\u8bba\u575b\u548c\u4ee5\u524d\u8ba8\u8bba\u7684\u6863\u6848\u3002<\/p>\n<h2>about the author\u200c<\/h2>\n<h2>\u5173\u4e8e\u4f5c\u8005<\/h2>\n<p><img decoding=\"async\" src=\"\/images\/aspnetcoreinaction\/0001.png\" alt=\"alt text\" \/><\/p>\n<p>ANDREW LOCK is a .NET developer and Microsoft MVP. He graduated with an engineering degree from Cambridge University, specializing in software engineering, and went on to obtain a PhD in digital image processing. He has been developing professionally with .NET since 2010, using a wide range of technologies, including WinForms, ASP.NET WebForms, ASP.NET MVC, ASP.NET Webpages, and most recently ASP.NET Core. Andrew has put many ASP.NET Core applications into production since version 1 was released in 2016. He has an active blog at <a href=\"https:\/\/andrewlock.net\">https:\/\/andrewlock.net<\/a> dedicated to ASP.NET Core. This blog has frequently been featured in the community spotlight by the ASP.NET team at Microsoft, on the .NET blog, and in the weekly community standups.<\/p>\n<p>ANDREW LOCK\u662f\u4e00\u540d.NET\u5f00\u53d1\u4eba\u5458\u548cMicrosoftM VP\u3002\u4ed6\u6bd5\u4e1a\u4e8e\u5251\u6865\u5927\u5b66\uff0c\u83b7\u5f97\u5de5\u7a0b\u5b66\u4f4d\uff0c\u4e13\u653b\u8f6f\u4ef6\u5de5\u7a0b\uff0c\u5e76\u7ee7\u7eed\u83b7\u5f97\u6570\u5b57\u56fe\u50cf\u5904\u7406\u535a\u58eb\u5b66\u4f4d\u3002\u81ea2010\u5e74\u4ee5\u6765\uff0c\u4ed6\u4e00\u76f4\u5728\u4f7f\u7528.NET\u8fdb\u884c\u4e13\u4e1a\u5f00\u53d1\uff0c\u4f7f\u7528\u5404\u79cd\u6280\u672f\uff0c\u5305\u62ecWinForms\u3001ASP.NET WebForms\u3001ASP.NET MVC\u3001ASP.NET Webpages\uff0c\u4ee5\u53ca\u6700\u8fd1\u7684ASP.NET Core\u3002\u81ea2016\u5e74\u53d1\u5e03\u7b2c1\u7248\u4ee5\u6765\uff0cAndrew\u5df2\u7ecf\u5c06\u8bb8\u591aASP.NET Core\u5e94\u7528\u7a0b\u5e8f\u6295\u5165\u751f\u4ea7\u3002\u4ed6\u5728 <a href=\"https:\/\/andrewlock.net\">https:\/\/andrewlock.net<\/a> \u4e0a\u6709\u4e00\u4e2a\u6d3b\u8dc3\u7684\u535a\u5ba2\uff0c\u4e13\u95e8\u7528\u4e8eASP.NET Core\u3002\u6b64\u535a\u5ba2\u7ecf\u5e38\u51fa\u73b0\u5728Microsoft\u7684ASP.NET\u56e2\u961f\u7684\u793e\u533a\u805a\u5149\u706f\u3001.NET\u535a\u5ba2\u548c\u6bcf\u5468\u793e\u533a\u7ad9\u7acb\u4f1a\u8bae\u4e2d\u3002<\/p>\n<h2>about the cover illustration\u200c<\/h2>\n<h2>\u5173\u4e8e\u5c01\u9762\u63d2\u56fe<\/h2>\n<p><img decoding=\"async\" src=\"\/images\/aspnetcoreinaction\/0002.png\" alt=\"alt text\" \/><\/p>\n<p>The caption for the illustration on the cover of ASP.NET Core in Action, Third Edition, is \u201cThe Captain Pasha. Kapudan pasha, admiral of the Turkish navy,\u201d taken from a collection published in 1802 by William Miller.<\/p>\n<p>\u300aASP.NET Corein Action\u300b\u7b2c\u4e09\u7248\u5c01\u9762\u4e0a\u7684\u63d2\u56fe\u8bf4\u660e\u662f\u201c\u5e15\u590f\u8239\u957f\u3002Kapudanpasha\uff0c\u571f\u8033\u5176\u6d77\u519b\u4e0a\u5c06\u201d\uff0c\u6458\u81ea\u5a01\u5ec9\u00b7\u7c73\u52d2\uff08William Miller\uff09\u4e8e1802\u5e74\u51fa\u7248\u7684\u6587\u96c6\u3002<\/p>\n<p>In those days, it was easy to identify where people lived and what their trade or station in life was by their dress alone.<\/p>\n<p>\u5728\u90a3\u4e9b\u65e5\u5b50\u91cc\uff0c\u4ec5\u51ed\u4ed6\u4eec\u7684\u8863\u7740\u5f88\u5bb9\u6613\u786e\u5b9a\u4eba\u4eec\u5c45\u4f4f\u7684\u5730\u65b9\u4ee5\u53ca\u4ed6\u4eec\u7684\u804c\u4e1a\u6216\u751f\u6d3b\u5730\u4f4d\u3002<\/p>\n<p>Manning celebrates the inventiveness and initiative of the computer business with book covers based on the rich diversity of regional culture centuries ago, brought back to life by pictures from collections such as this one.<\/p>\n<p>Manning\u4ee5\u51e0\u4e2a\u4e16\u7eaa\u524d\u4e30\u5bcc\u591a\u6837\u7684\u5730\u533a\u6587\u5316\u4e3a\u57fa\u7840\u7684\u4e66\u7c4d\u5c01\u9762\u6765\u5e86\u795d\u8ba1\u7b97\u673a\u884c\u4e1a\u7684\u521b\u9020\u529b\u548c\u4e3b\u52a8\u6027\uff0c\u8fd9\u4e9b\u4e66\u7c4d\u901a\u8fc7\u50cf\u8fd9\u6837\u7684\u6536\u85cf\u4e2d\u7684\u56fe\u7247\u91cd\u65b0\u7115\u53d1\u4e86\u751f\u673a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ASP.NET Core in Action Preface preface \u524d\u8a00 ASP.NET has a long history; Microsoft released the first version in 2002 as part of the original .NET Framework 1.0. Since then, it&#8217;s been through multiple iterations, each version bringing added features and extensibility. Each iteration, however, was built on the same underlying framework provided by System.Web.dll. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[19],"class_list":["post-566","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-asp-net-core-in-action"],"_links":{"self":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts\/566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=566"}],"version-history":[{"count":0,"href":"https:\/\/diji.net\/index.php?rest_route=\/wp\/v2\/posts\/566\/revisions"}],"wp:attachment":[{"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diji.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}