text: (self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[196],{3905:function(e,n,t){"use strict";t.d(n,{Zo:function(){return m},kt:function(){return u}});var a=t(7294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){i(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){if(null==e)return{};var t,a,i=function(e,n){if(null==e)return{};var t,a,i={},o=Object.keys(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},m=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},c=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),c=s(t),u=i,k=c["".concat(p,".").concat(u)]||c[u]||d[u]||o;return t?a.createElement(k,r(r({ref:n},m),{},{components:t})):a.createElement(k,r({ref:n},m))}));function u(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var o=t.length,r=new Array(o);r[0]=c;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s<o;s++)r[s]=t[s];return a.createElement.apply(null,r)}return a.createElement.apply(null,t)}c.displayName="MDXCreateElement"},8215:function(e,n,t){"use strict";var a=t(7294);n.Z=function(e){var n=e.children,t=e.hidden,i=e.className;return a.createElement("div",{role:"tabpanel",hidden:t,className:i},n)}},1395:function(e,n,t){"use strict";t.d(n,{Z:function(){return m}});var a=t(7294),i=t(944),o=t(6010),r="tabItem_1uMI",l="tabItemActive_2DSg";var p=37,s=39;var m=function(e){var n=e.lazy,t=e.block,m=e.defaultValue,d=e.values,c=e.groupId,u=e.className,k=(0,i.Z)(),N=k.tabGroupChoices,v=k.setTabGroupChoices,g=(0,a.useState)(m),f=g[0],h=g[1],C=a.Children.toArray(e.children),y=[];if(null!=c){var w=N[c];null!=w&&w!==f&&d.some((function(e){return e.value===w}))&&h(w)}var b=function(e){var n=e.currentTarget,t=y.indexOf(n),a=d[t].value;h(a),null!=c&&(v(c,a),setTimeout((function(){var e,t,a,i,o,r,p,s;(e=n.getBoundingClientRect(),t=e.top,a=e.left,i=e.bottom,o=e.right,r=window,p=r.innerHeight,s=r.innerWidth,t>=0&&o<=s&&i<=p&&a>=0)||(n.scrollIntoView({block:"center",behavior:"smooth"}),n.classList.add(l),setTimeout((function(){return n.classList.remove(l)}),2e3))}),150))},j=function(e){var n,t;switch(e.keyCode){case s:var a=y.indexOf(e.target)+1;t=y[a]||y[0];break;case p:var i=y.indexOf(e.target)-1;t=y[i]||y[y.length-1]}null==(n=t)||n.focus()};return a.createElement("div",{className:"tabs-container"},a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},u)},d.map((function(e){var n=e.value,t=e.label;return a.createElement("li",{role:"tab",tabIndex:f===n?0:-1,"aria-selected":f===n,className:(0,o.Z)("tabs__item",r,{"tabs__item--active":f===n}),key:n,ref:function(e){return y.push(e)},onKeyDown:j,onFocus:b,onClick:b},t)}))),n?(0,a.cloneElement)(C.filter((function(e){return e.props.value===f}))[0],{className:"margin-vert--md"}):a.createElement("div",{className:"margin-vert--md"},C.map((function(e,n){return(0,a.cloneElement)(e,{key:n,hidden:e.props.value!==f})}))))}},9443:function(e,n,t){"use strict";var a=(0,t(7294).createContext)(void 0);n.Z=a},944:function(e,n,t){"use strict";var a=t(7294),i=t(9443);n.Z=function(){var e=(0,a.useContext)(i.Z);if(null==e)throw new Error("`useUserPreferencesContext` is used outside of `Layout` Component.");return e}},9763:function(e,n,t){"use strict";t.r(n),t.d(n,{frontMatter:function(){return p},metadata:function(){return s},toc:function(){return m},default:function(){return c}});var a=t(4034),i=t(9973),o=(t(7294),t(3905)),r=(t(4996),t(1395)),l=t(8215),p={id:"configuration",title:"4.1 \u914d\u7f6e",sidebar_label:"4.1 \u914d\u7f6e"},s={unversionedId:"configuration",id:"configuration",isDocsHomePage:!1,title:"4.1 \u914d\u7f6e",description:"\u63a8\u8350\u4f7f\u7528 \u300a4.2 \u9009\u9879\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002\uff08\u4e3a\u4ec0\u4e48\uff09\uff1f",source:"@site/docs/configuration.mdx",sourceDirName:".",slug:"/configuration",permalink:"/furion/docs/configuration",editUrl:"https://gitee.com/dotnetchina/Furion/tree/master/handbook/docs/configuration.mdx",version:"current",lastUpdatedBy:"Monk",lastUpdatedAt:1623134974,formattedLastUpdatedAt:"6/8/2021",sidebar_label:"4.1 \u914d\u7f6e",frontMatter:{id:"configuration",title:"4.1 \u914d\u7f6e",sidebar_label:"4.1 \u914d\u7f6e"},sidebar:"docs",previous:{title:"3. \u5e94\u7528\u542f\u52a8 Startup",permalink:"/furion/docs/appstartup"},next:{title:"4.2 \u9009\u9879",permalink:"/furion/docs/options"}},m=[{value:"4.1.1 \u4ec0\u4e48\u662f\u914d\u7f6e",id:"411-\u4ec0\u4e48\u662f\u914d\u7f6e",children:[]},{value:"4.1.2 \u914d\u7f6e\u7684\u4f7f\u7528",id:"412-\u914d\u7f6e\u7684\u4f7f\u7528",children:[{value:"4.1.2.1 \u914d\u7f6e <code>appsettings.json</code> \u4fe1\u606f",id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.2 \u8bfb\u53d6 <code>appsettings.json</code> \u4fe1\u606f",id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f",children:[]},{value:"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f",children:[]}]},{value:"4.1.3 <code>\u8def\u5f84\u7b26</code> \u67e5\u627e\u8282\u70b9",id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9",children:[{value:"4.1.3.1 \u67e5\u627e\u6570\u7ec4\u8282\u70b9",id:"4131-\u67e5\u627e\u6570\u7ec4\u8282\u70b9",children:[]}]},{value:"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6",children:[{value:"4.1.4.1 \u8bfb\u53d6 <code>emailsetting.json</code> \u914d\u7f6e",id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e",children:[]},{value:"4.1.4.2 \u6392\u9664\u7279\u5b9a\u914d\u7f6e\u6587\u4ef6",id:"4142-\u6392\u9664\u7279\u5b9a\u914d\u7f6e\u6587\u4ef6",children:[]}]},{value:"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6",id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6",children:[]},{value:"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08<code>\u70ed\u66f4\u65b0</code>\uff09",id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09",children:[]},{value:"4.1.7 \u624b\u52a8\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6",id:"417-\u624b\u52a8\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6",children:[]},{value:"4.1.8 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",id:"418-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9",children:[]},{value:"4.1.9 \u914d\u7f6e\u4f7f\u7528\u573a\u666f",id:"419-\u914d\u7f6e\u4f7f\u7528\u573a\u666f",children:[]},{value:"4.1.10 \u53cd\u9988\u4e0e\u5efa\u8bae",id:"4110-\u53cd\u9988\u4e0e\u5efa\u8bae",children:[]}],d={toc:m};function c(e){var n=e.components,t=(0,i.Z)(e,["components"]);return(0,o.kt)("wrapper",(0,a.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u6e29\u99a8\u63d0\u793a")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u63a8\u8350\u4f7f\u7528 \u300a",(0,o.kt)("a",{parentName:"p",href:"/furion/docs/options"},"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u672c\u7ae0\u8282\u529f\u80fd\u3002\uff08",(0,o.kt)("a",{parentName:"p",href:"#418-%E9%85%8D%E7%BD%AE%E7%9A%84%E4%BC%98%E7%BC%BA%E7%82%B9"},"\u4e3a\u4ec0\u4e48"),"\uff09\uff1f"))),(0,o.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u81ea\u5b9a\u4e49\u914d\u7f6e\u7279\u522b\u6ce8\u610f")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u5982\uff1a",(0,o.kt)("inlineCode",{parentName:"p"},"xxxx.json"),"\uff0c\u5fc5\u987b\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"VS Studio")," \u4e2d\u53f3\u952e\u5c5e\u6027\u8bbe\u7f6e ",(0,o.kt)("inlineCode",{parentName:"p"},"\u590d\u5236"),"\u8f93\u51fa\u76ee\u5f55\u4e3a",(0,o.kt)("inlineCode",{parentName:"p"},"\u5982\u679c\u8f83\u65b0\u5219\u590d\u5236"),"\uff0c\u751f\u6210\u64cd\u4f5c\u4e3a\uff1a",(0,o.kt)("inlineCode",{parentName:"p"},"\u5185\u5bb9"),"\u3002"))),(0,o.kt)("h2",{id:"411-\u4ec0\u4e48\u662f\u914d\u7f6e"},"4.1.1 \u4ec0\u4e48\u662f\u914d\u7f6e"),(0,o.kt)("p",null,"\u7b80\u5355\u6765\u8bf4\uff0c\u914d\u7f6e\u5c06\u7cfb\u7edf\u5e94\u7528\u53ef\u52a8\u6001\u8c03\u914d\u7684\u9009\u9879\u653e\u5728\u7edf\u4e00\u5730\u65b9\u7ba1\u7406\uff0c\u901a\u8fc7\u4e0d\u540c\u7684\u914d\u7f6e\u8ba9\u7cfb\u7edf\u505a\u51fa\u52a8\u6001\u8c03\u6574\u3002"),(0,o.kt)("p",null,"\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u5e94\u7528\u7a0b\u5e8f\u542f\u52a8\u65f6\u9ed8\u8ba4\u52a0\u8f7d ",(0,o.kt)("inlineCode",{parentName:"p"},"\u542f\u52a8\u9879\u76ee")," \u4e0b\u7684 ",(0,o.kt)("inlineCode",{parentName:"p"},"appsettings.json")," \u4f5c\u4e3a\u5e94\u7528\u914d\u7f6e\u3002\u540c\u65f6\u8fd8\u652f\u6301",(0,o.kt)("strong",{parentName:"p"},"\u4e0d\u540c\u7684\u8fd0\u884c\u73af\u5883"),"\u52a0\u8f7d\u5bf9\u5e94\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982\uff1a"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Development"),"\uff1a\u52a0\u8f7d ",(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.Development.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Staging"),"\uff1a\u52a0\u8f7d ",(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"{Environment}"),"\uff1a",(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.{Environment}.json"))),(0,o.kt)("h2",{id:"412-\u914d\u7f6e\u7684\u4f7f\u7528"},"4.1.2 \u914d\u7f6e\u7684\u4f7f\u7528"),(0,o.kt)("p",null,"\u5047\u8bbe\u6211\u4eec\u9700\u8981\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u83b7\u53d6",(0,o.kt)("strong",{parentName:"p"},"\u7cfb\u7edf\u540d\u79f0\u3001\u7248\u672c\u53f7\u53ca\u7248\u6743\u4fe1\u606f"),"\uff0c\u8fd9\u4e9b\u4fe1\u606f\u53ef\u80fd\u968f\u65f6\u53d8\u5316\u800c\u4e14\u9700\u8981\u5728\u591a\u4e2a\u5730\u65b9\u4f7f\u7528\u3002\u8fd9\u65f6\u5c31\u9700\u8981\u5c06\u8fd9\u4e9b\u4fe1\u606f\u914d\u7f6e\u8d77\u6765\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a"),(0,o.kt)("h3",{id:"4121-\u914d\u7f6e-appsettingsjson-\u4fe1\u606f"},"4.1.2.1 \u914d\u7f6e ",(0,o.kt)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json",metastring:"{2-6}","{2-6}":!0},'{\n  "AppInfo": {\n    "Name": "Furion",\n    "Version": "1.0.0",\n    "Company": "Baiqian"\n  }\n}\n')),(0,o.kt)("div",{className:"admonition admonition-caution alert alert--warning"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"}))),"\u7279\u522b\u6ce8\u610f")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},(0,o.kt)("inlineCode",{parentName:"p"},"appsettings.json")," \u590d\u5236\u8f93\u51fa\u76ee\u5f55\u4e3a",(0,o.kt)("inlineCode",{parentName:"p"},"\u5982\u679c\u8f83\u65b0\u5219\u590d\u5236"),"\uff0c\u751f\u6210\u64cd\u4f5c\u4e3a\uff1a",(0,o.kt)("inlineCode",{parentName:"p"},"\u5185\u5bb9"),"\u3002"))),(0,o.kt)("h3",{id:"4122-\u8bfb\u53d6-appsettingsjson-\u4fe1\u606f"},"4.1.2.2 \u8bfb\u53d6 ",(0,o.kt)("inlineCode",{parentName:"h3"},"appsettings.json")," \u4fe1\u606f"),(0,o.kt)("p",null,"\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4e2d\uff0c\u63d0\u4f9b\u4e86\u4e24\u79cd\u8bfb\u53d6\u65b9\u5f0f\uff1a"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"\u4f9d\u8d56\u6ce8\u5165 ",(0,o.kt)("inlineCode",{parentName:"li"},"IConfiguration")," \u5bf9\u8c61\u8bfb\u53d6"),(0,o.kt)("li",{parentName:"ul"},"\u901a\u8fc7 ",(0,o.kt)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),(0,o.kt)(r.Z,{defaultValue:"App.Configuration[jsonKey]",values:[{label:"App.Configuration[jsonKey]",value:"App.Configuration[jsonKey]"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f"}],mdxType:"Tabs"},(0,o.kt)(l.Z,{value:"App.Configuration[jsonKey]",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{11-13}","{11-13}":!0},'using Microsoft.AspNetCore.Mvc;\n\nnamespace Furion.Web.Entry.Controllers\n{\n    [Route("api/[controller]")]\n    public class DefaultController : ControllerBase\n    {\n        [HttpGet]\n        public string Get()\n        {\n            return $@"\u540d\u79f0\uff1a{App.Configuration["AppInfo:Name"]}\uff0c\n                      \u7248\u672c\uff1a{App.Configuration["AppInfo:Version"]}\uff0c\n                      \u516c\u53f8\uff1a{App.Configuration["AppInfo:Company"]}";\n        }\n    }\n}\n'))),(0,o.kt)(l.Z,{value:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{2,10-15}","{2,10-15}":!0},'using Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Configuration;\n\nnamespace Furion.Web.Entry.Controllers\n{\n    [Route("api/[controller]")]\n    public class DefaultController : ControllerBase\n    {\n        [HttpGet]\n        public string Get([FromServices] IConfiguration configuration)\n        {\n            return $@"\u540d\u79f0\uff1a{configuration["AppInfo:Name"]}\uff0c\n                      \u7248\u672c\uff1a{configuration["AppInfo:Version"]}\uff0c\n                      \u516c\u53f8\uff1a{configuration["AppInfo:Company"]}";\n        }\n    }\n}\n')))),(0,o.kt)("div",{className:"admonition admonition-tip alert alert--success"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"}))),"\u4f9d\u8d56\u6ce8\u5165\u7684\u65b9\u5f0f")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u901a\u8fc7\u4f9d\u8d56\u6ce8\u5165\u6ce8\u5165\u5b9e\u4f8b\u6709\u51e0\u79cd\u65b9\u5f0f\uff1a"),(0,o.kt)("ul",{parentName:"div"},(0,o.kt)("li",{parentName:"ul"},"\u6784\u9020\u51fd\u6570\u6ce8\u5165\u65b9\u5f0f")),(0,o.kt)("pre",{parentName:"div"},(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{2}","{2}":!0},"private readonly IConfiguration _configuration;\npublic DefaultController(IConfiguration configuration)\n{\n    _configuration = configuration;\n}\n")),(0,o.kt)("ul",{parentName:"div"},(0,o.kt)("li",{parentName:"ul"},"\u53c2\u6570\u6ce8\u5165\u65b9\u5f0f ",(0,o.kt)("inlineCode",{parentName:"li"},"[FromServices]"))),(0,o.kt)("pre",{parentName:"div"},(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1}","{1}":!0},"public string Get([FromServices] IConfiguration configuration)\n{\n}\n")),(0,o.kt)("ul",{parentName:"div"},(0,o.kt)("li",{parentName:"ul"},"\u5c5e\u6027\u6ce8\u5165\u65b9\u5f0f")),(0,o.kt)("pre",{parentName:"div"},(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{1}","{1}":!0},"public IConfiguration Configuration { get; set; }\n")),(0,o.kt)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u300a",(0,o.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-3.1"},"ASP.NET Core - \u4f9d\u8d56\u6ce8\u5165"),"\u300b \u77e5\u8bc6"))),(0,o.kt)("h3",{id:"4123-\u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"},"4.1.2.3 \u5982\u4f55\u9009\u62e9\u8bfb\u53d6\u65b9\u5f0f"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"\u5728\u53ef\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u4f9d\u8d56\u6ce8\u5165 ",(0,o.kt)("inlineCode",{parentName:"li"},"IConfiguration")," \u8bfb\u53d6"),(0,o.kt)("li",{parentName:"ul"},"\u5728\u9759\u6001\u7c7b/\u975e\u4f9d\u8d56\u6ce8\u5165\u7c7b\u4e2d\uff0c\u9009\u62e9 ",(0,o.kt)("inlineCode",{parentName:"li"},"App.Configuration[jsonKey]")," \u8bfb\u53d6")),(0,o.kt)("h2",{id:"413-\u8def\u5f84\u7b26-\u67e5\u627e\u8282\u70b9"},"4.1.3 ",(0,o.kt)("inlineCode",{parentName:"h2"},"\u8def\u5f84\u7b26")," \u67e5\u627e\u8282\u70b9"),(0,o.kt)("p",null,"\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4e2d\uff0c\u914d\u7f6e\u91c7\u7528 ",(0,o.kt)("inlineCode",{parentName:"p"},":")," \u5206\u9694\u7b26\u6765\u8bfb\u53d6\u5206\u5c42\u914d\u7f6e\u6570\u636e\u3002\u5982\u4e0a\u8ff0\u4f8b\u5b50\u4e2d\u7684 ",(0,o.kt)("inlineCode",{parentName:"p"},"AppInfo:Name"),"\u3002\u5982\u6709\u66f4\u591a\u5c42\u7ea7\u6570\u636e\u5219\u53ea\u9700\u8981\u901a\u8fc7 ",(0,o.kt)("inlineCode",{parentName:"p"},":")," \u8fdb\u5165\u4e0b\u4e00\u5c42\u8282\u70b9\u5373\u53ef\u3002"),(0,o.kt)("p",null,"\u5047\u8bbe\u6211\u4eec\u6709\u4ee5\u4e0b\u914d\u7f6e\u4fe1\u606f\uff1a"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json",metastring:"{5-12}","{5-12}":!0},'{\n  "AppInfo": {\n    "Name": "Furion",\n    "Version": "1.0.0",\n    "Company": {\n      "Name": "Baiqian",\n      "Address": {\n        "City": "\u4e2d\u56fd",\n        "Province": "\u5e7f\u4e1c\u7701",\n        "Detail": "\u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8"\n      }\n    }\n  }\n}\n')),(0,o.kt)(r.Z,{defaultValue:"two",values:[{label:"\u8bfb\u53d6\u7b2c\u4e8c\u5c42",value:"two"},{label:"\u8bfb\u53d6\u7b2c\u4e09\u5c42",value:"three"},{label:"\u8bfb\u53d6\u7b2c\u56db\u5c42",value:"four"},{label:"\u8bfb\u53d6\u7b2cN\u5c42",value:"n"}],mdxType:"Tabs"},(0,o.kt)(l.Z,{value:"two",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var companyName = App.Configuration["AppInfo:Name"]; // => Furion\n'))),(0,o.kt)(l.Z,{value:"three",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var companyName = App.Configuration["AppInfo:Company:Name"]; // => Baiqian\n'))),(0,o.kt)(l.Z,{value:"four",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var companyName = App.Configuration["AppInfo:Company:Address:Detail"]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n'))),(0,o.kt)(l.Z,{value:"n",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var companyName = App.Configuration["AppInfo:Tier2:Tier3:Tier4...Tiern1:Tiern3..."]; // => \u4e2d\u5c71\u5e02\u4e1c\u533a\u7d2b\u9a6c\u516c\u56ed\u897f\u95e8\n')))),(0,o.kt)("h3",{id:"4131-\u67e5\u627e\u6570\u7ec4\u8282\u70b9"},"4.1.3.1 \u67e5\u627e\u6570\u7ec4\u8282\u70b9"),(0,o.kt)("p",null,"\u6709\u4e9b\u65f6\u5019\u6211\u4eec\u9700\u8981\u6216\u8005\u6570\u7ec4\u7279\u5b9a\u7684\u67d0\u4e9b\uff0c\u53ef\u4ee5\u901a\u8fc7 ",(0,o.kt)("inlineCode",{parentName:"p"},'App.Configuration["array:0"]')," \u83b7\u53d6\uff0c",(0,o.kt)("inlineCode",{parentName:"p"},"0")," \u662f\u7d22\u5f15\u6570\u5b57\u3002"),(0,o.kt)("h2",{id:"414-\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"},"4.1.4 \u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6"),(0,o.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"XML \u914d\u7f6e\u8bf4\u660e")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},(0,o.kt)("inlineCode",{parentName:"p"},"Furion v2.8.0")," \u7248\u672c\u79fb\u9664\u4e86 ",(0,o.kt)("inlineCode",{parentName:"p"},".xml")," \u6587\u4ef6\u81ea\u52a8\u626b\u63cf\u914d\u7f6e\u4e86\uff0c\u6539\u4e3a\u624b\u52a8\u6dfb\u52a0\u914d\u7f6e\u3002"))),(0,o.kt)("p",null,"\u5927\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7684\u914d\u7f6e\u53ea\u9700\u8981\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u914d\u7f6e\u5373\u53ef\uff0c\u4f46\u4e00\u4e9b\u7279\u6b8a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5e0c\u671b\u67d0\u4e9b\u7ec4\u4ef6\u6216\u529f\u80fd\u62e5\u6709\u72ec\u7acb\u7684\u914d\u7f6e\uff0c\u8fd9\u4e2a\u65f6\u5019\u5c31\u9700\u8981\u7528\u5230\u81ea\u5b9a\u4e49\u914d\u7f6e\uff0c",(0,o.kt)("inlineCode",{parentName:"p"},"Furion")," \u76ee\u524d\u652f\u6301 ",(0,o.kt)("inlineCode",{parentName:"p"},".json")," \u548c ",(0,o.kt)("inlineCode",{parentName:"p"},".xml")," \u4e24\u79cd\u65b9\u5f0f\u914d\u7f6e\uff0c\u5982\uff1a"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json",metastring:'{2-13} title="Furion.Web.Entry/emailsetting.json"',"{2-13}":!0,title:'"Furion.Web.Entry/emailsetting.json"'},'{\n  "outlook": {\n    "smtp": {\n      "server": "smtp.office365.com",\n      "port": "587",\n      "ssl": "STARTTLS"\n    },\n    "pop": {\n      "server": "outlook.office365.com",\n      "port": "995",\n      "ssl": "TLS"\n    }\n  }\n}\n')),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-xml"},'<?xml version="1.0" encoding="utf-8" ?>\n<configuration>\n  <MyKey>MyXMLFile Value</MyKey>\n  <Position>\n    <Title>Title from  MyXMLFile</Title>\n    <Name>Name from MyXMLFile</Name>\n  </Position>\n  <Logging>\n    <LogLevel>\n      <Default>Information</Default>\n      <Microsoft>Warning</Microsoft>\n    </LogLevel>\n  </Logging>\n</configuration>\n')),(0,o.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"xml \u914d\u7f6e\u4e8b\u9879")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u5982\u679c\u91c7\u7528 ",(0,o.kt)("inlineCode",{parentName:"p"},"xml")," \u914d\u7f6e\uff0c\u90a3\u4e48\u6587\u4ef6\u540d\u5fc5\u987b\u4ee5 ",(0,o.kt)("inlineCode",{parentName:"p"},".config.xml")," \u7ed3\u5c3e\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002"))),(0,o.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u7279\u522b\u8bf4\u660e")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},(0,o.kt)("inlineCode",{parentName:"p"},"Furion")," \u6846\u67b6\u4f1a\u5728\u542f\u52a8\u65f6\u81ea\u52a8\u626b\u63cf\u6bcf\u4e00\u4e2a\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u4e0b\u7684 ",(0,o.kt)("inlineCode",{parentName:"p"},"*.json")," \u548c ",(0,o.kt)("inlineCode",{parentName:"p"},"*.xml")," \u6587\u4ef6\u52a0\u5165\u914d\u7f6e\u4e2d\uff0c\u6240\u4ee5\u65e0\u9700\u624b\u5de5\u914d\u7f6e\u3002"),(0,o.kt)("p",{parentName:"div"},"\u65b0\u589e ",(0,o.kt)("inlineCode",{parentName:"p"},"*.json")," \u548c ",(0,o.kt)("inlineCode",{parentName:"p"},"*.xml")," \u6587\u4ef6\u7684\u5c5e\u6027",(0,o.kt)("inlineCode",{parentName:"p"},"\u590d\u5236\u5230\u8f93\u51fa\u76ee\u5f55"),"\u8bbe\u7f6e\u4e3a\u59cb\u7ec8\u590d\u5236\u6216\u8f83\u65b0\u590d\u5236\uff0c\u5426\u5219\u4e0d\u4f1a\u8f7d\u5165\u3002\u53e6\u5916\u914d\u7f6e\u6587\u4ef6\u4e0d\u80fd\u51fa\u73b0\u91cd\u540d\uff0c\u4e5f\u5c31\u662f\u4fdd\u8bc1\u6574\u4e2a\u9879\u76ee\u4e2d\u914d\u7f6e\u6587\u4ef6\u540d\u5b57\u552f\u4e00\u3002"))),(0,o.kt)("p",null,"\u540c\u65f6 ",(0,o.kt)("inlineCode",{parentName:"p"},"Furion")," \u63d0\u4f9b\u4e86\u975e\u5e38\u7075\u6d3b\u7684\u65b9\u5f0f\u652f\u6301\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\uff0c\u5982\uff1a"),(0,o.kt)("h3",{id:"4141-\u8bfb\u53d6-emailsettingjson-\u914d\u7f6e"},"4.1.4.1 \u8bfb\u53d6 ",(0,o.kt)("inlineCode",{parentName:"h3"},"emailsetting.json")," \u914d\u7f6e"),(0,o.kt)("p",null,"\u8bfb\u53d6\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u548c\u8bfb\u53d6 ",(0,o.kt)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e00\u81f4\uff0c\u7cfb\u7edf\u4f1a\u81ea\u52a8\u4ece\u591a\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5982\uff1a"),(0,o.kt)(r.Z,{defaultValue:"jtl",values:[{label:"App.Configuration[jsonKey]",value:"jtl"},{label:"\u4f9d\u8d56\u6ce8\u5165\u65b9\u5f0f",value:"ylzr"}],mdxType:"Tabs"},(0,o.kt)(l.Z,{value:"jtl",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var smtpServer = App.Configuration["outlook:smtp:server"]; // => smtp.office365.com\n'))),(0,o.kt)(l.Z,{value:"ylzr",mdxType:"TabItem"},(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs"},'var smtpServer = _configuration["outlook:smtp:server"]; // => smtp.office365.com\n')))),(0,o.kt)("h3",{id:"4142-\u6392\u9664\u7279\u5b9a\u914d\u7f6e\u6587\u4ef6"},"4.1.4.2 \u6392\u9664\u7279\u5b9a\u914d\u7f6e\u6587\u4ef6"),(0,o.kt)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u4e0d\u9700\u8981 ",(0,o.kt)("inlineCode",{parentName:"p"},".json")," \u6216 ",(0,o.kt)("inlineCode",{parentName:"p"},".xml")," \u81ea\u52a8\u8f7d\u5165\u914d\u7f6e\u4e2d\uff0c\u6211\u4eec\u53ea\u9700\u8981\u5728\u542f\u52a8\u5c42 ",(0,o.kt)("inlineCode",{parentName:"p"},"appsettings.json")," \u4e2d\u6dfb\u52a0 ",(0,o.kt)("inlineCode",{parentName:"p"},"IgnoreConfigurationFiles")," \u8282\u70b9\u5373\u53ef\uff1a"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "IgnoreConfigurationFiles": ["runtime.json"]\n}\n')),(0,o.kt)("h2",{id:"415-\u4e0d\u540c\u73af\u5883\u8bfb\u53d6"},"4.1.5 \u4e0d\u540c\u73af\u5883\u8bfb\u53d6"),(0,o.kt)("p",null,"\u5728\u5b9e\u9645\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u53ef\u80fd\u4f1a\u6839\u636e\u4e0d\u540c\u7684\u73af\u5883\u52a0\u8f7d\u4e0d\u540c\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u5982 ",(0,o.kt)("inlineCode",{parentName:"p"},"\u6570\u636e\u5e93\u8fde\u63a5\u5b57\u7b26\u4e32"),"\u3002"),(0,o.kt)("p",null,"\u8fd9\u65f6\u6211\u4eec\u53ea\u9700\u8981\u9075\u5faa\u7279\u5b9a\u547d\u540d\u89c4\u8303 ",(0,o.kt)("inlineCode",{parentName:"p"},"{name}.{Environment}.json")," \u5373\u53ef\u3002\u5982\uff1a"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.Development.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.Staging.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"appsettings.Production.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"emailsetting.Development.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"emailsetting.Staging.json")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"emailsetting.Production.json"))),(0,o.kt)("p",null,"\u8fd9\u65f6\uff0c",(0,o.kt)("inlineCode",{parentName:"p"},"ASP.NET Core")," \u4f1a\u5728\u5e94\u7528\u542f\u52a8\u65f6\u81ea\u52a8\u52a0\u8f7d\u4e0d\u540c\u73af\u5883\u7684\u914d\u7f6e\u6587\u4ef6\u3002"),(0,o.kt)("h2",{id:"416-\u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08\u70ed\u66f4\u65b0\uff09"},"4.1.6 \u914d\u7f6e\u66f4\u6539\u901a\u77e5\uff08",(0,o.kt)("inlineCode",{parentName:"h2"},"\u70ed\u66f4\u65b0"),"\uff09"),(0,o.kt)("p",null,"\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},".NET Core")," \u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u914d\u7f6e\u652f\u6301\u66f4\u6539\u901a\u77e5\uff0c\u4e5f\u5c31\u662f\u70ed\u66f4\u65b0\u64cd\u4f5c\u3002",(0,o.kt)("strong",{parentName:"p"},"\u4e00\u65e6\u76d1\u542c\u5230 ",(0,o.kt)("inlineCode",{parentName:"strong"},"appsetting.json")," \u6216\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\u53d1\u751f\u53d8\u52a8\uff0c\u5c31\u4f1a\u89e6\u53d1 ",(0,o.kt)("inlineCode",{parentName:"strong"},"OnChange")," \u65b9\u6cd5"),"\u3002\u4ee3\u7801\u5982\u4e0b\uff1a"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{2,4-5}","{2,4-5}":!0},'var appInfoConfiguration = App.Configuration.GetSection("AppInfo");\nChangeToken.OnChange(() => App.Configuration.GetReloadToken(), () =>\n{\n  var name = appInfoConfiguration["Name"];  // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n  var version = appInfoConfiguration["Version"];  // \u5b9e\u65f6\u7684\u6700\u65b0\u503c\n});\n')),(0,o.kt)("div",{className:"admonition admonition-important alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u76d1\u542c\u5bf9\u8c61")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u5982\u679c\u76d1\u542c\u5168\u5c40\u914d\u7f6e\u6587\u4ef6\u4f20\u5165 ",(0,o.kt)("inlineCode",{parentName:"p"},"App.Configuration.GetReloadToken()"),"\uff0c\u5982\u679c\u53ea\u9700\u8981\u76d1\u542c\u7279\u5b9a\u8282\u70b9\uff0c\u4f20\u5165 ",(0,o.kt)("inlineCode",{parentName:"p"},'App.Configuration.GetSection("AppInfo")')))),(0,o.kt)("h2",{id:"417-\u624b\u52a8\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6"},"4.1.7 \u624b\u52a8\u6dfb\u52a0\u914d\u7f6e\u6587\u4ef6"),(0,o.kt)("p",null,"\u6709\u4e9b\u65f6\u5019\uff0c\u6211\u4eec\u7684\u914d\u7f6e\u6587\u4ef6\u6ca1\u6709\u653e\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u9700\u8981\u624b\u52a8\u8f7d\u5165\u81ea\u5b9a\u4e49\u914d\u7f6e\u6587\u4ef6\uff0c\u53ea\u9700\u8981\u5728 ",(0,o.kt)("inlineCode",{parentName:"p"},"Program.cs")," \u4e2d\u52a0\u8f7d\u5373\u53ef\uff1a"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-cs",metastring:"{10,13}","{10,13}":!0},'public class Program\n{\n    public static void Main(string[] args)\n    {\n        CreateHostBuilder(args).Build().Run();\n    }\n\n    public static IHostBuilder CreateHostBuilder(string[] args) =>\n        Host.CreateDefaultBuilder(args)\n            .ConfigureAppConfiguration((hostingContext, config) =>\n            {\n                // \u52a0\u8f7d\u81ea\u5b9a\u4e49\u914d\u7f6e\n                config.AddJsonFile("MyConfig.json", optional: true, reloadOnChange: true);\n            })\n            .ConfigureWebHostDefaults(webBuilder =>\n            {\n                webBuilder.UseStartup<Startup>();\n            });\n}\n')),(0,o.kt)("div",{className:"admonition admonition-info alert alert--info"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"}))),"\u8865\u5145\u8bf4\u660e")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("ul",{parentName:"div"},(0,o.kt)("li",{parentName:"ul"},"\u83b7\u53d6\u9879\u76ee\u76ee\u5f55\uff1a",(0,o.kt)("inlineCode",{parentName:"li"},"AppContext.BaseDirectory")),(0,o.kt)("li",{parentName:"ul"},"\u83b7\u53d6\u7f51\u7ad9\u6839\u76ee\u5f55\uff1a",(0,o.kt)("inlineCode",{parentName:"li"},"Directory.GetCurrentDirectory()"))))),(0,o.kt)("h2",{id:"418-\u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"},"4.1.8 \u914d\u7f6e\u7684\u4f18\u7f3a\u70b9"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"\u4f18\u70b9"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"\u80fd\u591f\u5728\u7cfb\u7edf\u8fd0\u884c\u65f6\u5feb\u901f\u8bfb\u53d6"),(0,o.kt)("li",{parentName:"ul"},"\u65e0\u9700\u989d\u5916\u914d\u7f6e"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"\u7f3a\u70b9"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},"\u5b58\u5728\u91cd\u590d\u8bfb\u53d6"),(0,o.kt)("li",{parentName:"ul"},"\u901a\u8fc7\u786c\u7f16\u7801\u5b57\u7b26\u4e32\u8bfb\u53d6\uff0c\u5bb9\u6613\u51fa\u9519"),(0,o.kt)("li",{parentName:"ul"},"\u4e0d\u80fd\u8bbe\u7f6e\u9ed8\u8ba4\u503c"),(0,o.kt)("li",{parentName:"ul"},"\u4e0d\u80fd\u5728\u8fd0\u884c\u73af\u5883\u4e2d\u52a8\u6001\u914d\u7f6e"),(0,o.kt)("li",{parentName:"ul"},"\u4e0d\u80fd\u9a8c\u8bc1\u914d\u7f6e\u6709\u6548\u6027"),(0,o.kt)("li",{parentName:"ul"},"\u4e0d\u652f\u6301\u66f4\u6539\u901a\u77e5")))),(0,o.kt)("h2",{id:"419-\u914d\u7f6e\u4f7f\u7528\u573a\u666f"},"4.1.9 \u914d\u7f6e\u4f7f\u7528\u573a\u666f"),(0,o.kt)("p",null,"\u5982\u679c\u53ea\u9700\u8981",(0,o.kt)("strong",{parentName:"p"},"\u4e00\u6b21\u6027\u8bfb\u53d6"),"\u914d\u7f6e\u4fe1\u606f\uff0c\u5219\u4f7f\u7528\u914d\u7f6e\uff0c\u5426\u5219\u5e94\u8be5\u4f7f\u7528 \u300a",(0,o.kt)("a",{parentName:"p",href:"/furion/docs/options"},"4.2 \u9009\u9879"),"\u300b\u4ee3\u66ff\u3002"),(0,o.kt)("h2",{id:"4110-\u53cd\u9988\u4e0e\u5efa\u8bae"},"4.1.10 \u53cd\u9988\u4e0e\u5efa\u8bae"),(0,o.kt)("div",{className:"admonition admonition-note alert alert--secondary"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))),"\u4e0e\u6211\u4eec\u4ea4\u6d41")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u7ed9 Furion \u63d0 ",(0,o.kt)("a",{parentName:"p",href:"https://gitee.com/dotnetchina/Furion/issues/new?issue"},"Issue"),"\u3002"))),(0,o.kt)("hr",null),(0,o.kt)("div",{className:"admonition admonition-note alert alert--secondary"},(0,o.kt)("div",{parentName:"div",className:"admonition-heading"},(0,o.kt)("h5",{parentName:"div"},(0,o.kt)("span",{parentName:"h5",className:"admonition-icon"},(0,o.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,o.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))),"\u4e86\u89e3\u66f4\u591a")),(0,o.kt)("div",{parentName:"div",className:"admonition-content"},(0,o.kt)("p",{parentName:"div"},"\u60f3\u4e86\u89e3\u66f4\u591a ",(0,o.kt)("inlineCode",{parentName:"p"},"\u914d\u7f6e")," \u77e5\u8bc6\u53ef\u67e5\u9605 ",(0,o.kt)("a",{parentName:"p",href:"https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/?view=aspnetcore-5.0"},"ASP.NET Core - \u914d\u7f6e")," \u7ae0\u8282\u3002"))))}c.isMDXComponent=!0},6010:function(e,n,t){"use strict";function a(e){var n,t,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;n<e.length;n++)e[n]&&(t=a(e[n]))&&(i&&(i+=" "),i+=t);else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function i(){for(var e,n,t=0,i="";t<arguments.length;)(e=arguments[t++])&&(n=a(e))&&(i&&(i+=" "),i+=n);return i}t.d(n,{Z:function(){return i}})}}]);