{"id":56925,"date":"2024-10-10T15:32:17","date_gmt":"2024-10-10T07:32:17","guid":{"rendered":"https:\/\/server.hk\/cnblog\/56925\/"},"modified":"2024-10-10T15:32:17","modified_gmt":"2024-10-10T07:32:17","slug":"iis-%e6%8c%87%e4%bb%a4%ef%bc%9aset-webconfiguration-%e8%a8%ad%e7%bd%ae-web-%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/56925\/","title":{"rendered":"IIS \u6307\u4ee4\uff1aSet-WebConfiguration &#8211; \u8a2d\u7f6e Web \u914d\u7f6e"},"content":{"rendered":"<h1 id=\"iis-%e6%8c%87%e4%bb%a4%ef%bc%9aset-webconfiguration-%e8%a8%ad%e7%bd%ae-web-%e9%85%8d%e7%bd%ae-tzqNeVFwLJ\">IIS \u6307\u4ee4\uff1aSet-WebConfiguration &#8211; \u8a2d\u7f6e Web \u914d\u7f6e<\/h1>\n<p>\u5728\u73fe\u4ee3\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0cIIS\uff08Internet Information Services\uff09\u4f5c\u70ba\u5fae\u8edf\u7684\u4e00\u6b3e\u5f37\u5927\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5f0f\u7684\u90e8\u7f72\u3002\u5c0d\u65bc\u7cfb\u7d71\u7ba1\u7406\u54e1\u4f86\u8aaa\uff0c\u80fd\u5920\u6709\u6548\u5730\u914d\u7f6e\u548c\u7ba1\u7406IIS\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0eIIS\u4e2d\u7684\u4e00\u500b\u91cd\u8981\u6307\u4ee4\uff1a<code>Set-WebConfiguration<\/code>\uff0c\u4e26\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528\u6b64\u6307\u4ee4\u4f86\u8a2d\u7f6eWeb\u914d\u7f6e\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-set-webconfiguration%ef%bc%9f-tzqNeVFwLJ\">\u4ec0\u9ebc\u662f Set-WebConfiguration\uff1f<\/h2>\n<p><code>Set-WebConfiguration<\/code>\u662f\u4e00\u500bPowerShell\u6307\u4ee4\uff0c\u5141\u8a31\u7528\u6236\u5c0dIIS\u7684\u914d\u7f6e\u9032\u884c\u4fee\u6539\u3002\u9019\u500b\u6307\u4ee4\u53ef\u4ee5\u7528\u4f86\u8a2d\u7f6e\u5404\u7a2eWeb\u5c64\u7d1a\u7684\u914d\u7f6e\uff0c\u5305\u62ec\u61c9\u7528\u7a0b\u5f0f\u6c60\u3001\u7db2\u7ad9\u3001\u865b\u64ec\u76ee\u9304\u7b49\u3002\u901a\u904e\u9019\u500b\u6307\u4ee4\uff0c\u7cfb\u7d71\u7ba1\u7406\u54e1\u53ef\u4ee5\u5feb\u901f\u800c\u6709\u6548\u5730\u8abf\u6574IIS\u7684\u884c\u70ba\uff0c\u4ee5\u6eff\u8db3\u7279\u5b9a\u7684\u9700\u6c42\u3002<\/p>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e8%aa%9e%e6%b3%95-tzqNeVFwLJ\">\u57fa\u672c\u8a9e\u6cd5<\/h2>\n<p>\u4f7f\u7528<code>Set-WebConfiguration<\/code>\u6307\u4ee4\u7684\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>Set-WebConfiguration -Filter \"filter\" -Value \"value\" -PSPath \"path\"<\/code><\/pre>\n<ul>\n<li><strong>-Filter<\/strong>: \u6307\u5b9a\u8981\u4fee\u6539\u7684\u914d\u7f6e\u9805\u7684\u7be9\u9078\u5668\u3002<\/li>\n<li><strong>-Value<\/strong>: \u8a2d\u7f6e\u7684\u65b0\u503c\u3002<\/li>\n<li><strong>-PSPath<\/strong>: \u6307\u5b9a\u8981\u4fee\u6539\u7684IIS\u8def\u5f91\u3002<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e7%af%84%e4%be%8b-tzqNeVFwLJ\">\u4f7f\u7528\u7bc4\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u4f7f\u7528<code>Set-WebConfiguration<\/code>\u7684\u5be6\u969b\u7bc4\u4f8b\uff1a<\/p>\n<h3 id=\"%e7%af%84%e4%be%8b-1%ef%bc%9a%e8%a8%ad%e7%bd%ae%e7%b6%b2%e7%ab%99%e7%9a%84%e9%bb%98%e8%aa%8d%e6%96%87%e6%aa%94-tzqNeVFwLJ\">\u7bc4\u4f8b 1\uff1a\u8a2d\u7f6e\u7db2\u7ad9\u7684\u9ed8\u8a8d\u6587\u6a94<\/h3>\n<p>\u5047\u8a2d\u6211\u5011\u5e0c\u671b\u5c07\u67d0\u500b\u7db2\u7ad9\u7684\u9ed8\u8a8d\u6587\u6a94\u8a2d\u7f6e\u70ba<code>index.html<\/code>\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n<pre><code>Set-WebConfiguration -Filter \"system.webServer\/defaultDocument\/files\" -Value \"index.html\" -PSPath \"IIS:SitesYourWebsiteName\"<\/code><\/pre>\n<h3 id=\"%e7%af%84%e4%be%8b-2%ef%bc%9a%e8%a8%ad%e7%bd%ae%e6%87%89%e7%94%a8%e7%a8%8b%e5%bc%8f%e6%b1%a0%e7%9a%84%e5%9b%9e%e6%94%b6%e6%99%82%e9%96%93-tzqNeVFwLJ\">\u7bc4\u4f8b 2\uff1a\u8a2d\u7f6e\u61c9\u7528\u7a0b\u5f0f\u6c60\u7684\u56de\u6536\u6642\u9593<\/h3>\n<p>\u5982\u679c\u9700\u8981\u8a2d\u7f6e\u61c9\u7528\u7a0b\u5f0f\u6c60\u7684\u56de\u6536\u6642\u9593\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n<pre><code>Set-WebConfiguration -Filter \"system.applicationHost\/applicationPools\/add[@name='YourAppPoolName']\/recycling\" -Value \"true\" -PSPath \"IIS:AppPools\"<\/code><\/pre>\n<h2 id=\"%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a0%85-tzqNeVFwLJ\">\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>\u5728\u4f7f\u7528<code>Set-WebConfiguration<\/code>\u6307\u4ee4\u6642\uff0c\u6709\u5e7e\u9ede\u9700\u8981\u7279\u5225\u6ce8\u610f\uff1a<\/p>\n<ul>\n<li>\u78ba\u4fdd\u64c1\u6709\u8db3\u5920\u7684\u6b0a\u9650\u4f86\u57f7\u884c\u9019\u4e9b\u6307\u4ee4\uff0c\u901a\u5e38\u9700\u8981\u4ee5\u7ba1\u7406\u54e1\u8eab\u4efd\u904b\u884cPowerShell\u3002<\/li>\n<li>\u5728\u9032\u884c\u914d\u7f6e\u66f4\u6539\u4e4b\u524d\uff0c\u5efa\u8b70\u5099\u4efd\u73fe\u6709\u7684IIS\u914d\u7f6e\uff0c\u4ee5\u9632\u6b62\u610f\u5916\u932f\u8aa4\u5c0e\u81f4\u670d\u52d9\u4e2d\u65b7\u3002<\/li>\n<li>\u5728\u4fee\u6539\u914d\u7f6e\u5f8c\uff0c\u52d9\u5fc5\u6aa2\u67e5IIS\u7684\u904b\u884c\u72c0\u614b\uff0c\u78ba\u4fdd\u6240\u6709\u7db2\u7ad9\u548c\u61c9\u7528\u7a0b\u5f0f\u6b63\u5e38\u904b\u884c\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-tzqNeVFwLJ\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4f7f\u7528<code>Set-WebConfiguration<\/code>\u6307\u4ee4\uff0c\u7cfb\u7d71\u7ba1\u7406\u54e1\u53ef\u4ee5\u9748\u6d3b\u5730\u8abf\u6574IIS\u7684\u914d\u7f6e\uff0c\u4ee5\u6eff\u8db3\u4e0d\u540c\u7684\u9700\u6c42\u3002\u7121\u8ad6\u662f\u8a2d\u7f6e\u9ed8\u8a8d\u6587\u6a94\u9084\u662f\u8abf\u6574\u61c9\u7528\u7a0b\u5f0f\u6c60\u7684\u56de\u6536\u6642\u9593\uff0c\u9019\u500b\u6307\u4ee4\u90fd\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u529f\u80fd\u4f86\u7c21\u5316\u7ba1\u7406\u904e\u7a0b\u3002\u5c0d\u65bc\u9700\u8981\u9ad8\u6548\u7ba1\u7406\u7684\u74b0\u5883\uff0c\u9078\u64c7\u5408\u9069\u7684<code>VPS<\/code>\u89e3\u6c7a\u65b9\u6848\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002\u82e5\u60a8\u5c0d<code>\u9999\u6e2fVPS<\/code>\u6216\u5176\u4ed6<code>\u4e91\u670d\u52a1\u5668<\/code>\u89e3\u6c7a\u65b9\u6848\u611f\u8208\u8da3\uff0c\u8acb\u8a2a\u554f<a href=\"https:\/\/server.hk\">Server.HK<\/a>\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 IIS \u6307\u4ee4 Set-WebConfiguration \u4f86\u8f15\u9b06\u8a2d\u7f6e\u548c\u7ba1\u7406 Web \u914d\u7f6e\uff0c\u512a\u5316\u7db2\u7ad9\u6027\u80fd\u8207\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-56925","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=56925"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56925\/revisions"}],"predecessor-version":[{"id":56926,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56925\/revisions\/56926"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=56925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=56925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=56925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}