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
1 line
23 KiB
JavaScript
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[4038],{2204:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>o,contentTitle:()=>c,default:()=>m,frontMatter:()=>d,metadata:()=>t,toc:()=>h});var r=s(5893),i=s(1151),l=s(4996);const d={id:"singlefile",title:"34.5. \u5355\u6587\u4ef6\u53d1\u5e03",sidebar_label:"34.5. \u5355\u6587\u4ef6\u53d1\u5e03"},c=void 0,t={id:"singlefile",title:"34.5. \u5355\u6587\u4ef6\u53d1\u5e03",description:"\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 Furion 3.5.2 + \u7248\u672c\u4f7f\u7528\u3002",source:"@site/docs/singlefile.mdx",sourceDirName:".",slug:"/singlefile",permalink:"/docs/singlefile",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/singlefile.mdx",tags:[],version:"current",lastUpdatedBy:"liberty",lastUpdatedAt:1668576548,formattedLastUpdatedAt:"Nov 16, 2022",frontMatter:{id:"singlefile",title:"34.5. \u5355\u6587\u4ef6\u53d1\u5e03",sidebar_label:"34.5. \u5355\u6587\u4ef6\u53d1\u5e03"},sidebar:"docs",previous:{title:"34.4 \u4e8c\u7ea7\u865a\u62df\u76ee\u5f55\u90e8\u7f72",permalink:"/docs/virtual-deploy"},next:{title:"34.6 pm2 \u90e8\u7f72",permalink:"/docs/pm2"}},o={},h=[{value:"34.5.1 \u5386\u53f2\u80cc\u666f",id:"3451-\u5386\u53f2\u80cc\u666f",level:2},{value:"34.5.2 \u5fc5\u8981\u914d\u7f6e",id:"3452-\u5fc5\u8981\u914d\u7f6e",level:2},{value:"34.5.3 \u53d1\u5e03",id:"3453-\u53d1\u5e03",level:2},{value:"34.5.4 \u81ea\u5b9a\u4e49\u542f\u52a8\u7aef\u53e3",id:"3454-\u81ea\u5b9a\u4e49\u542f\u52a8\u7aef\u53e3",level:2},{value:"34.5.5 <code>pm2</code> \u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",id:"3455-pm2-\u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",level:2},{value:"34.5.5.1 \u8fd0\u884c\u5f0a\u7aef",id:"34551-\u8fd0\u884c\u5f0a\u7aef",level:3},{value:"34.5.5.2 <code>pm2</code> \u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",id:"34552-pm2-\u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",level:3},{value:"\u5fc5\u8981\u6761\u4ef6",id:"\u5fc5\u8981\u6761\u4ef6",level:4},{value:"34.5.5.3 <code>pm2</code> \u5e38\u89c1\u64cd\u4f5c",id:"34553-pm2-\u5e38\u89c1\u64cd\u4f5c",level:3},{value:"34.5.6 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"3456-\u53cd\u9988\u4e0e\u5efa\u8bae",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",mdxAdmonitionTitle:"mdxAdmonitionTitle",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"important",children:(0,r.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,r.jsx)(n.code,{children:"Furion 3.5.2 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,r.jsx)(n.h2,{id:"3451-\u5386\u53f2\u80cc\u666f",children:"34.5.1 \u5386\u53f2\u80cc\u666f"}),"\n",(0,r.jsxs)(n.p,{children:["\u81ea ",(0,r.jsx)(n.code,{children:".NET Core 3"})," \u8d77\uff0c\u5fae\u8f6f\u5c31\u63d0\u4f9b\u4e86\u5355\u6587\u4ef6\u53d1\u5e03\u7684\u6280\u672f\u652f\u6301\uff0c\u4f46\u5b9e\u9645\u4e0a\u5e76\u4e0d\u662f ",(0,r.jsx)(n.code,{children:".NET"})," \u6240\u6709 ",(0,r.jsx)(n.code,{children:"CLR"})," \u90fd\u652f\u6301\u5355\u6587\u4ef6\u53d1\u5e03\uff0c\u5982 ",(0,r.jsx)(n.code,{children:"Microsoft.Extensions.DependencyModel"})," \u5305\u672c\u8eab\u4e0d\u652f\u6301\u5355\u6587\u4ef6\u53d1\u5e03\uff0c\u539f\u56e0\u662f\u5185\u90e8\u4f7f\u7528\u4e86 ",(0,r.jsx)(n.code,{children:"Assembley.CodeBase"}),"\u3002"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"\u597d\u5de7\u4e0d\u5de7"}),"\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u4e2d\u62db\u4e86\uff0c\u5728\u8fc7\u53bb\u4e24\u5e74\u4e2d\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u4f9d\u8d56\u8be5\u5305\u7684 ",(0,r.jsx)(n.code,{children:"DependencyContext.Default"})," \u7279\u6027\u8fdb\u884c\u7a0b\u5e8f\u96c6\u626b\u63cf\uff0c\u6240\u4ee5\u5355\u6587\u4ef6\u53d1\u5e03\u4e5f\u5c31\u6210\u4e86 ",(0,r.jsx)(n.code,{children:"Furion"})," \u4e0d\u613f\u63d0\u8d77\u7684\u75db\uff01\uff01\uff01"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["\u7ec8\u4e8e\uff0c\u5728 ",(0,r.jsx)(n.code,{children:"Furion v3.5.2+"})," \u7248\u672c\u60f3\u51fa\u4e86\u65b0\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u81ea\u6b64\u5f7b\u5e95\u89e3\u51b3\u4e86\u5355\u6587\u4ef6\u53d1\u5e03\u7684\u95ee\u9898\u3002"]})}),"\n",(0,r.jsxs)(n.admonition,{type:"tip",children:[(0,r.jsxs)(n.mdxAdmonitionTitle,{children:[(0,r.jsx)(n.code,{children:".NET"})," \u5b98\u65b9\u5355\u6587\u4ef6\u53d1\u5e03\u8bf4\u660e"]}),(0,r.jsx)(n.p,{children:(0,r.jsx)(n.a,{href:"https://docs.microsoft.com/zh-cn/dotnet/core/deploying/single-file/overview",children:"https://docs.microsoft.com/zh-cn/dotnet/core/deploying/single-file/overview"})})]}),"\n",(0,r.jsx)(n.h2,{id:"3452-\u5fc5\u8981\u914d\u7f6e",children:"34.5.2 \u5fc5\u8981\u914d\u7f6e"}),"\n",(0,r.jsxs)(n.p,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"Furion v3.5.2+"})," \u7248\u672c\u4e4b\u540e\uff0c\u65b0\u589e\u4e86 ",(0,r.jsx)(n.code,{children:"ISingleFilePublish"})," \u63a5\u53e3\u3002"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u7f16\u8f91\u542f\u52a8\u5c42 ",(0,r.jsx)(n.code,{children:".csproj"})," \u6587\u4ef6\uff0c\u6dfb\u52a0\u4e0b\u5217\u4ee3\u7801\u5230 ",(0,r.jsx)(n.code,{children:"<PropertyGroup>"})," \u8282\u70b9\u4e2d"]})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-xml",metastring:"showLineNumbers",children:"<PublishReadyToRunComposite>true</PublishReadyToRunComposite>\n"})}),"\n",(0,r.jsxs)(n.admonition,{type:"important",children:[(0,r.jsxs)(n.mdxAdmonitionTitle,{children:["\u5173\u4e8e ",(0,r.jsx)(n.code,{children:"ReadyToRun"})]}),(0,r.jsxs)(n.p,{children:["\u5982\u679c\u53d1\u5e03\u65f6\u672a\u6253\u52fe ",(0,r.jsx)(n.code,{children:"ReadyToRun"})," \u9009\u9879\uff0c\u5219\u65e0\u9700\u914d\u7f6e\u4e0a\u8ff0\u4ee3\u7801\u3002"]})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsxs)(n.strong,{children:["\u5728 ",(0,r.jsx)(n.code,{children:"Web \u542f\u52a8\u5c42"})," \u521b\u5efa\u7c7b\u578b\u5e76\u5b9e\u73b0\u8be5\u63a5\u53e3"]}),"\uff0c\u5982\uff1a"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {8,15,26,28-35}",children:'using System.Reflection;\r\n\r\nnamespace YourProject.Web.Entry;\r\n\r\n/// <summary>\r\n/// \u89e3\u51b3\u5355\u6587\u4ef6\u53d1\u5e03\u95ee\u9898\r\n/// </summary>\r\npublic class SingleFilePublish : ISingleFilePublish\r\n{\r\n /// <summary>\r\n /// \u89e3\u51b3\u5355\u6587\u4ef6\u4e0d\u80fd\u626b\u63cf\u7684\u7a0b\u5e8f\u96c6\r\n /// </summary>\r\n /// <remarks>\u548c <see cref="IncludeAssemblyNames"/> \u53ef\u540c\u65f6\u914d\u7f6e</remarks>\r\n /// <returns></returns>\r\n public Assembly[] IncludeAssemblies()\r\n {\r\n // \u9700\u8981 Furion \u6846\u67b6\u626b\u63cf\u54ea\u4e9b\u7a0b\u5e8f\u96c6\u5c31\u5199\u4e0a\u53bb\u5373\u53ef\r\n return Array.Empty<Assembly>();\r\n }\r\n\r\n /// <summary>\r\n /// \u89e3\u51b3\u5355\u6587\u4ef6\u4e0d\u80fd\u626b\u63cf\u7684\u7a0b\u5e8f\u96c6\u540d\u79f0\r\n /// </summary>\r\n /// <remarks>\u548c <see cref="IncludeAssemblies"/> \u53ef\u540c\u65f6\u914d\u7f6e</remarks>\r\n /// <returns></returns>\r\n public string[] IncludeAssemblyNames()\r\n {\r\n // \u9700\u8981 Furion \u6846\u67b6\u626b\u63cf\u54ea\u4e9b\u7a0b\u5e8f\u96c6\u5c31\u5199\u4e0a\u53bb\u5373\u53ef\r\n return new[]\r\n {\r\n "YourProject.Application",\r\n "YourProject.Core",\r\n "YourProject.EntityFramework.Core",\r\n "YourProject.Web.Core",\r\n "Furion.Extras.ObjectMapper.Mapster" // \u89e3\u51b3 Mapster \u5355\u6587\u4ef6\u5931\u6548\u95ee\u9898\uff0cv3.5.3+\u7248\u672c\u540e\u65e0\u9700\u914d\u7f6e\r\n };\r\n }\r\n}\n'})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u914d\u7f6e\u8bf4\u660e",type:"tip",children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"IncludeAssemblies"})," \u548c ",(0,r.jsx)(n.code,{children:"IncludeAssemblyNames"})," \u7684\u533a\u522b\u662f\u524d\u8005\u662f\u5f00\u53d1\u8005\u76f4\u63a5\u8fd4\u56de ",(0,r.jsx)(n.code,{children:"Assembley"})," \u96c6\u5408\uff0c\u540e\u8005\u662f\u76f4\u63a5\u8fd4\u56de\u540d\u79f0\uff0c",(0,r.jsx)(n.code,{children:"Furion"})," \u4f1a\u81ea\u52a8\u52a0\u8f7d\u7a0b\u5e8f\u96c6\uff0c",(0,r.jsx)(n.strong,{children:"\u53ef\u540c\u65f6\u914d\u7f6e\uff0c\u4e5f\u53ef\u4ee5\u914d\u7f6e\u5176\u4e2d\u4e00\u4e2a\u3002"})]}),(0,r.jsxs)(n.p,{children:["\u5982\u679c\u53ea\u914d\u7f6e\u542f\u7528\u4e00\u4e2a\uff0c\u5219\u53e6\u5916\u4e00\u4e2a\u8fd4\u56de ",(0,r.jsx)(n.code,{children:"Array.Empty<Assembley>()"})," \u6216 ",(0,r.jsx)(n.code,{children:"Array.Empty<string>()"})," \u5373\u53ef\u3002"]}),(0,r.jsxs)(n.p,{children:["\u5982\u679c\u53d1\u5e03\u540e\u51fa\u73b0 ",(0,r.jsx)(n.code,{children:"Mapster"})," \u4e0d\u80fd\u6620\u5c04\u95ee\u9898\uff0c\u53ef\u5c06 ",(0,r.jsx)(n.code,{children:"Furion.Extras.ObjectMapper.Mapster"})," \u6dfb\u52a0\u5230 ",(0,r.jsx)(n.code,{children:"IncludeAssemblyNames"})," \u96c6\u5408\u4e2d\u5373\u53ef\u3002",(0,r.jsxs)(n.strong,{children:[(0,r.jsx)(n.code,{children:"v3.5.3+"})," \u7248\u672c\u540e\u65e0\u9700\u914d\u7f6e\u3002"]})]})]}),"\n",(0,r.jsx)(n.h2,{id:"3453-\u53d1\u5e03",children:"34.5.3 \u53d1\u5e03"}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf1.png")}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf2.png")}),"\n",(0,r.jsxs)(n.admonition,{title:"\u5c0f\u77e5\u8bc6",type:"tip",children:[(0,r.jsxs)(n.p,{children:["\u5982\u65e0\u9700\u751f\u6210 ",(0,r.jsx)(n.code,{children:".pdb"})," \u8c03\u8bd5\u5305\u53ef\u5728\u751f\u6210\u4e2d\u7981\u7528\u5373\u53ef\u3002"]}),(0,r.jsx)("img",{src:(0,l.Z)("img/sf3.png")})]}),"\n",(0,r.jsx)(n.h2,{id:"3454-\u81ea\u5b9a\u4e49\u542f\u52a8\u7aef\u53e3",children:"34.5.4 \u81ea\u5b9a\u4e49\u542f\u52a8\u7aef\u53e3"}),"\n",(0,r.jsxs)(n.p,{children:["\u9ed8\u8ba4\u5355\u6587\u4ef6\u53d1\u5e03\u76d1\u542c\u7684\u662f ",(0,r.jsx)(n.code,{children:"https://localhost:5001"}),"\uff0c\u5982\u679c\u9700\u8981\u4fee\u6539\uff0c\u53ef\u5728 ",(0,r.jsx)(n.code,{children:"program.cs"})," \u4e2d\u914d\u7f6e\uff1a"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers {2}",children:'var builder = WebApplication.CreateBuilder(args).Inject();\r\nbuilder.WebHost.UseUrls("https://*:8089");\r\nvar app = builder.Build();\r\napp.Run();\n'})}),"\n",(0,r.jsxs)(n.p,{children:["\u8fd9\u6837\u5c31\u53ef\u4ee5\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:"https://localhost:8089"})," \u8bbf\u95ee\u3002"]}),"\n",(0,r.jsxs)(n.h2,{id:"3455-pm2-\u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",children:["34.5.5 ",(0,r.jsx)(n.code,{children:"pm2"})," \u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72"]}),"\n",(0,r.jsx)(n.h3,{id:"34551-\u8fd0\u884c\u5f0a\u7aef",children:"34.5.5.1 \u8fd0\u884c\u5f0a\u7aef"}),"\n",(0,r.jsxs)(n.p,{children:["\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5c06\u5e94\u7528\u7a0b\u5e8f\u53d1\u5e03\u6210\u5355\u6587\u4ef6\u540e\uff0c\u9700\u70b9\u51fb ",(0,r.jsx)(n.code,{children:"XXXXX.exe"})," \u8fdb\u884c\u542f\u52a8\uff0c\u8fd9\u65f6\u5019\u7a0b\u5e8f\u81ea\u52a8\u6253\u5f00\u7ec8\u7aef\uff08\u63a7\u5236\u53f0\uff09\uff0c\u4e4b\u540e\u6839\u636e\u63d0\u793a\u5728\u6d4f\u89c8\u5668\u4e0a\u6253\u5f00\u5bf9\u5e94\u7684\u5730\u5740\u5373\u53ef\u3002"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"\u4f46\u662f\u8fd9\u79cd\u65b9\u5f0f\u6709\u4ee5\u4e0b\u95ee\u9898\uff1a"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"\u5fc5\u987b\u4fdd\u8bc1\u7ec8\u7aef/\u63a7\u5236\u53f0\u4e00\u76f4\u8fd0\u884c"}),"\n",(0,r.jsx)(n.li,{children:"\u7ec8\u7aef/\u63a7\u5236\u53f0\u6709\u65f6\u5019\u4f1a\u51fa\u73b0\u5047\u6b7b\u7684\u60c5\u51b5\uff0c\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u65e0\u6cd5\u8bbf\u95ee"}),"\n",(0,r.jsx)(n.li,{children:"\u65e0\u6cd5\u5b9e\u65f6\u76d1\u542c\u5e94\u7528\u7a0b\u5e8f\u8d44\u6e90\u4f7f\u7528\u60c5\u51b5\uff08\u5982 CPU\uff0c\u5185\u5b58\uff0c\u65e5\u5fd7\u7b49\uff09"}),"\n",(0,r.jsx)(n.li,{children:"\u65e0\u6cd5\u6620\u5c04\u7aef\u53e3\u542f\u52a8"}),"\n",(0,r.jsx)(n.li,{children:"\u96c6\u7fa4\u53d8\u5f97\u590d\u6742"}),"\n"]}),"\n",(0,r.jsxs)(n.h3,{id:"34552-pm2-\u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72",children:["34.5.5.2 ",(0,r.jsx)(n.code,{children:"pm2"})," \u5b88\u62a4\u8fdb\u7a0b\u90e8\u7f72"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4e3a\u4e86\u89e3\u51b3\u4e0a\u8ff0\u95ee\u9898\uff0c\u63a8\u8350 ",(0,r.jsx)(n.code,{children:"NodeJS"})," \u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684\u5de5\u5177 ",(0,r.jsx)(n.code,{children:"pm2"})," ",(0,r.jsx)(n.a,{href:"https://pm2.keymetrics.io/",children:"https://pm2.keymetrics.io/"}),"\uff0c\u901a\u8fc7\u8be5\u5de5\u5177\u53ef\u4ee5\u89e3\u51b3\u4e0a\u8ff0\u7684\u6240\u6709\u95ee\u9898\u3002"]}),"\n",(0,r.jsx)(n.h4,{id:"\u5fc5\u8981\u6761\u4ef6",children:"\u5fc5\u8981\u6761\u4ef6"}),"\n",(0,r.jsxs)(n.ol,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u7cfb\u7edf\u5fc5\u987b\u5b89\u88c5 ",(0,r.jsx)(n.code,{children:"NodeJS"})," \u73af\u5883 ",(0,r.jsx)(n.a,{href:"https://nodejs.org/en/",children:"https://nodejs.org/en/"})]})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"\u76f8\u4fe1\u5927\u90e8\u5206\u4eba\u7535\u8111\u90fd\u5df2\u7ecf\u5b89\u88c5\u3002"}),"\n",(0,r.jsxs)(n.ol,{start:"2",children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsxs)(n.strong,{children:["\u901a\u8fc7 ",(0,r.jsx)(n.code,{children:"npm"})," \u6216 ",(0,r.jsx)(n.code,{children:"yarn"})," \u5168\u5c40\u5b89\u88c5 ",(0,r.jsx)(n.code,{children:"pm2"})," \u5de5\u5177"]})}),"\n"]}),"\n",(0,r.jsx)(n.p,{children:"npm:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"npm install pm2@latest -g\n"})}),"\n",(0,r.jsx)(n.p,{children:"yarn:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"yarn global add pm2\n"})}),"\n",(0,r.jsxs)(n.ol,{start:"3",children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f"})}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["\u4f7f\u7528 ",(0,r.jsx)(n.code,{children:"pm2"})," \u975e\u5e38\u7b80\u5355\u5c31\u53ef\u4ee5\u542f\u52a8\u5b88\u62a4\u8fdb\u7a0b\u5e94\u7528\u7a0b\u5e8f\u3002"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 start --name pms PMS.Web.Entry.exe\n"})}),"\n",(0,r.jsxs)(n.admonition,{title:"\u6307\u5b9a\u7aef\u53e3",type:"important",children:[(0,r.jsx)(n.p,{children:"\u5982\u9700\u6307\u5b9a\u7aef\u53e3\uff0c\u53ef\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\uff1a"}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 start --name pms PMS.Web.Entry.exe -- --urls=https://localhost:8089\n"})}),(0,r.jsxs)(n.p,{children:["\u6ce8\u610f ",(0,r.jsx)(n.code,{children:"--"})," \u540e\u9762\u53ef\u4ee5\u5199\u5b8c\u6574\u7684 ",(0,r.jsx)(n.code,{children:"dotnet"})," \u547d\u4ee4\u3002"]})]}),"\n",(0,r.jsxs)(n.admonition,{title:"\u547d\u4ee4\u8bf4\u660e",type:"tip",children:[(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"pms.exe"})," \u4e3a\u9879\u76ee\u53d1\u5e03\u540e\u7684\u542f\u52a8\u5c42\u540d\u79f0\uff0c\u5982\u679c\u540d\u79f0\u5305\u542b ",(0,r.jsx)(n.code,{children:"\u7a7a\u683c"}),"\uff0c\u5219\u4f7f\u7528\u53cc\u5f15\u53f7\u5305\u88f9\uff0c\u5982 ",(0,r.jsx)(n.code,{children:'"p ms.exe"'}),"\u3002"]}),(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"--name"})," \u914d\u7f6e\u5e94\u7528\u7a0b\u5e8f\u5728 ",(0,r.jsx)(n.code,{children:"pm2"})," \u4e2d\u7684\u552f\u4e00\u6807\u8bc6\u3002"]})]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"start"})," \u540e\u9762\u8ddf\u7740\u662f ",(0,r.jsx)(n.code,{children:".exe"})," \u6587\u4ef6\uff0c\u5728 ",(0,r.jsx)(n.code,{children:"linux/macos"})," \u4e0b\u65e0\u9700\u6307\u5b9a\u540e\u7f00\u540d\u3002"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsxs)(n.strong,{children:["\u542f\u52a8\u6210\u529f\u540e\u5373\u53ef\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee\u6307\u5b9a\u7aef\u53e3\uff0c\u901a\u5e38\u662f ",(0,r.jsx)(n.code,{children:"http://localhost:5000"})]})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"PS C:\\Users\\bqrjsoft\\Desktop\\pms> pm2 start --name pms PMS.Web.Entry.exe\r\n[PM2] Starting C:\\Users\\bqrjsoft\\Desktop\\pms\\PMS.Web.Entry.exe in fork_mode (1 instance)\r\n[PM2] Done.\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502 id \u2502 name \u2502 namespace \u2502 version \u2502 mode \u2502 pid \u2502 uptime \u2502 \u21ba \u2502 status \u2502 cpu \u2502 mem \u2502 user \u2502 watching \u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502 0 \u2502 pms \u2502 default \u2502 N/A \u2502 fork \u2502 41764 \u2502 0s \u2502 0 \u2502 online \u2502 0% \u2502 85.0mb \u2502 bqrjsoft \u2502 disabled \u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\nPS C:\\Users\\bqrjsoft\\Desktop\\pms>\n"})}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf30.png")}),"\n",(0,r.jsxs)(n.h3,{id:"34553-pm2-\u5e38\u89c1\u64cd\u4f5c",children:["34.5.5.3 ",(0,r.jsx)(n.code,{children:"pm2"})," \u5e38\u89c1\u64cd\u4f5c"]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u5b9e\u65f6\u76d1\u542c\u8fd0\u884c\u72b6\u6001"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 monit\n"})}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf4.png")}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u663e\u793a\u8fd0\u884c\u65e5\u5fd7"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 logs\n"})}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf5.png")}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u67e5\u770b\u5e94\u7528\u4fe1\u606f"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 info pms\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u6ce8\u610f\uff0c",(0,r.jsx)(n.code,{children:"pms"})," \u4e3a\u60a8\u914d\u7f6e\u7684 ",(0,r.jsx)(n.code,{children:"--name"})," \u540d\u79f0\u3002"]}),"\n",(0,r.jsx)("img",{src:(0,l.Z)("img/sf6.png")}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u968f\u673a\u542f\u52a8"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"pm2 startup\r\npm2 save\n"})}),"\n",(0,r.jsxs)(n.admonition,{type:"tip",children:[(0,r.jsxs)(n.mdxAdmonitionTitle,{children:[(0,r.jsx)(n.code,{children:"Windows"})," \u4e0b\u968f\u673a\u542f\u52a8"]}),(0,r.jsxs)(n.p,{children:["\u53ef\u67e5\u9605 ",(0,r.jsx)(n.a,{href:"https://www.npmjs.com/package/pm2-windows-startup",children:"pm2-windows-startup"}),"\u3002"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"npm install pm2-windows-startup -g\r\npm2-startup install\r\npm2 save\n"})})]}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.strong,{children:"\u5176\u4ed6\u64cd\u4f5c"})}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-bash",metastring:"showLineNumbers",children:"// \u91cd\u542f\u5e94\u7528\r\npm2 restart app_name\r\n\r\n// \u91cd\u8f7d\u5e94\u7528\r\npm2 reload app_name\r\n\r\n// \u505c\u6b62\u5e94\u7528\r\npm2 stop app_name\r\n\r\n// \u5220\u9664\u5e94\u7528\r\npm2 delete app_name\n"})}),"\n",(0,r.jsxs)(n.p,{children:["\u66f4\u591a ",(0,r.jsx)(n.code,{children:"pm2"})," \u6587\u6863\u53ef\u67e5\u9605 ",(0,r.jsx)(n.a,{href:"https://pm2.keymetrics.io/docs/usage/quick-start/",children:"https://pm2.keymetrics.io/docs/usage/quick-start/"})]}),"\n",(0,r.jsx)(n.h2,{id:"3456-\u53cd\u9988\u4e0e\u5efa\u8bae",children:"34.5.6 \u53cd\u9988\u4e0e\u5efa\u8bae"}),"\n",(0,r.jsx)(n.admonition,{title:"\u4e0e\u6211\u4eec\u4ea4\u6d41",type:"note",children:(0,r.jsxs)(n.p,{children:["\u7ed9 Furion \u63d0 ",(0,r.jsx)(n.a,{href:"https://gitee.com/dotnetchina/Furion/issues/new?issue",children:"Issue"}),"\u3002"]})})]})}function m(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},1151:(e,n,s)=>{s.d(n,{Z:()=>c,a:()=>d});var r=s(7294);const i={},l=r.createContext(i);function d(e){const n=r.useContext(l);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),r.createElement(l.Provider,{value:n},e.children)}}}]); |