You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
23 KiB
JavaScript

12 months ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[5713],{5310:(n,e,r)=>{r.r(e),r.d(e,{assets:()=>d,contentTitle:()=>c,default:()=>a,frontMatter:()=>t,metadata:()=>o,toc:()=>p});var s=r(5893),i=r(1151);const t={id:"appstartup",title:"3.1 AppStartup \u542f\u52a8",sidebar_label:"3.1 AppStartup \u542f\u52a8",description:"\u5408\u7406\u7684\u914d\u7f6e\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u7684\u670d\u52a1\u4f9d\u8d56"},c=void 0,o={id:"appstartup",title:"3.1 AppStartup \u542f\u52a8",description:"\u5408\u7406\u7684\u914d\u7f6e\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u7684\u670d\u52a1\u4f9d\u8d56",source:"@site/docs/appstartup.mdx",sourceDirName:".",slug:"/appstartup",permalink:"/docs/appstartup",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/appstartup.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1679624314,formattedLastUpdatedAt:"Mar 24, 2023",frontMatter:{id:"appstartup",title:"3.1 AppStartup \u542f\u52a8",sidebar_label:"3.1 AppStartup \u542f\u52a8",description:"\u5408\u7406\u7684\u914d\u7f6e\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u7684\u670d\u52a1\u4f9d\u8d56"},sidebar:"docs",previous:{title:"3. \u5e94\u7528\u542f\u52a8",permalink:"/docs/category/appstart"},next:{title:"3.2 \u7ec4\u4ef6\u5316\u542f\u52a8",permalink:"/docs/component"}},d={},p=[{value:"3.1.1 <code>Startup</code> \u7c7b",id:"311-startup-\u7c7b",level:2},{value:"3.1.1.1 <code>Startup</code> \u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",id:"3111-startup-\u4e24\u4e2a\u91cd\u8981\u65b9\u6cd5",level:3},{value:"3.1.2 <code>AppStartup</code>",id:"312-appstartup",level:2},{value:"3.1.2.1 \u5982\u4f55\u914d\u7f6e <code>AppStartup</code>",id:"3121-\u5982\u4f55\u914d\u7f6e-appstartup",level:3},{value:"3.1.2.2 <code>AppStartup</code> \u7ea6\u5b9a",id:"3122-appstartup-\u7ea6\u5b9a",level:3},{value:"3.1.2.3 <code>AppStartup</code> \u914d\u7f6e\u987a\u5e8f",id:"3123-appstartup-\u914d\u7f6e\u987a\u5e8f",level:3},{value:"3.1.2.4 <code>AppStartup</code> \u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",id:"3124-appstartup-\u65b9\u6cd5\u8c03\u7528\u987a\u5e8f",level:3},{value:"3.1.3 <code>Startup</code> \u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",id:"313-startup-\u914d\u7f6e\u6700\u4f73\u5b9e\u8df5",level:2},{value:"3.1.4 \u6784\u9020\u51fd\u6570\u6ce8\u5165\u8bf4\u660e",id:"314-\u6784\u9020\u51fd\u6570\u6ce8\u5165\u8bf4\u660e",level:2},{value:"3.1.5 \u5173\u4e8e <code>appsettings.json</code>",id:"315-\u5173\u4e8e-appsettingsjson",level:2},{value:"3.1.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"316-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function l(n){const e={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...n.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(e.h2,{id:"311-startup-\u7c7b",children:["3.1.1 ",(0,s.jsx)(e.code,{children:"Startup"})," \u7c7b"]}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.code,{children:"Startup"})," \u7c7b\u662f ",(0,s.jsx)(e.code,{children:"ASP.NET Core"})," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u9ed8\u8ba4\u8c03\u7528\u7684\u7c7b\uff0c\u8be5\u7c7b\u662f\u5728 ",(0,s.jsx)(e.code,{children:"Program.cs"})," \u4e2d\u914d\u7f6e\uff1a"]}),"\n",(0,s.jsxs)(e.p,{children:[(0,s.jsx)(e.strong,{children:".NET5"})," \u65b9\u5f0f"]}),"\n",(0,s.jsx)(e.pre,{children:(0,s.jsx)(e.code,{className:"language-cs",metastring:'showLineNumbers {18} title="Furion.Web.Entry\\Program.cs"',children:"using Microsoft.AspNetCore.Hosting;\r\nusing Microsoft.Extensions.Hosting;\r\n\r\nnamespace Furion.Web.Entry\r\n{\r\n public class Program\r\n {\r\n public static void Main(string[] args)\r\n {\r\n CreateHostBuilder(args).Build().Run();\r\n }\r\n\r\n public static IHostBuilder CreateHostBuilder(string[] args)\r\n {\r\n return Host.CreateDefaultBuilder(args)\r\n .ConfigureWebHostDefaults(webBuilder =>\r\n {\r\n webBuilder.UseStartup<Startup>();\r\n });\r\n }\r\n }\r\n}\n"