{"id":48826,"date":"2024-10-08T00:28:14","date_gmt":"2024-10-07T16:28:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/48826\/"},"modified":"2024-10-08T00:28:15","modified_gmt":"2024-10-07T16:28:15","slug":"iis-%e7%9b%a3%e6%8e%a7%e8%ab%8b%e6%b1%82%e8%85%b3%e6%9c%ac%e5%88%86%e4%ba%ab","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/48826\/","title":{"rendered":"IIS \u76e3\u63a7\u8acb\u6c42\u8173\u672c\u5206\u4eab"},"content":{"rendered":"<h1 id=\"iis-%e7%9b%a3%e6%8e%a7%e8%ab%8b%e6%b1%82%e8%85%b3%e6%9c%ac%e5%88%86%e4%ba%ab-vCbqtPnCfi\">IIS \u76e3\u63a7\u8acb\u6c42\u8173\u672c\u5206\u4eab<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u7db2\u7d61\u74b0\u5883\u4e2d\uff0c\u7db2\u7ad9\u7684\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u81f3\u95dc\u91cd\u8981\u3002\u5c0d\u65bc\u4f7f\u7528 Internet Information Services (IIS) \u7684\u4f3a\u670d\u5668\u7ba1\u7406\u54e1\u4f86\u8aaa\uff0c\u76e3\u63a7\u8acb\u6c42\u7684\u80fd\u529b\u53ef\u4ee5\u5e6b\u52a9\u53ca\u6642\u767c\u73fe\u554f\u984c\u4e26\u9032\u884c\u8abf\u6574\u3002\u672c\u6587\u5c07\u5206\u4eab\u4e00\u4e9b\u6709\u6548\u7684 IIS \u76e3\u63a7\u8acb\u6c42\u8173\u672c\uff0c\u5e6b\u52a9\u60a8\u66f4\u597d\u5730\u7ba1\u7406\u4f3a\u670d\u5668\u3002<\/p>\n<h2 id=\"iis-%e7%9b%a3%e6%8e%a7%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7-vCbqtPnCfi\">IIS \u76e3\u63a7\u7684\u91cd\u8981\u6027<\/h2>\n<p>IIS \u662f\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\u5e8f\u3002\u76e3\u63a7\u8acb\u6c42\u4e0d\u50c5\u80fd\u5920\u63d0\u9ad8\u7db2\u7ad9\u7684\u6027\u80fd\uff0c\u9084\u80fd\u53ca\u6642\u767c\u73fe\u6f5b\u5728\u7684\u5b89\u5168\u5a01\u8105\u3002\u900f\u904e\u76e3\u63a7\uff0c\u7ba1\u7406\u54e1\u53ef\u4ee5\u7372\u5f97\u4ee5\u4e0b\u5e7e\u65b9\u9762\u7684\u6578\u64da\uff1a<\/p>\n<ul>\n<li>\u8acb\u6c42\u7684\u6578\u91cf\u548c\u985e\u578b<\/li>\n<li>\u97ff\u61c9\u6642\u9593<\/li>\n<li>\u932f\u8aa4\u7387<\/li>\n<li>\u7528\u6236\u8a2a\u554f\u7684\u5730\u7406\u4f4d\u7f6e<\/li>\n<\/ul>\n<h2 id=\"%e4%bd%bf%e7%94%a8-powershell-%e7%9b%a3%e6%8e%a7-iis-%e8%ab%8b%e6%b1%82-vCbqtPnCfi\">\u4f7f\u7528 PowerShell \u76e3\u63a7 IIS \u8acb\u6c42<\/h2>\n<p>PowerShell \u662f\u4e00\u500b\u5f37\u5927\u7684\u81ea\u52d5\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4f86\u76e3\u63a7 IIS \u7684\u8acb\u6c42\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684 PowerShell \u8173\u672c\u793a\u4f8b\uff0c\u7528\u65bc\u7372\u53d6 IIS \u7684\u8acb\u6c42\u65e5\u8a8c\uff1a<\/p>\n<pre><code>\n# \u8a2d\u5b9a\u65e5\u8a8c\u6a94\u6848\u7684\u8def\u5f91\n$logPath = \"C:inetpublogsLogFilesW3SVC1\"\n\n# \u7372\u53d6\u6700\u65b0\u7684\u65e5\u8a8c\u6a94\u6848\n$latestLog = Get-ChildItem $logPath | Sort-Object LastWriteTime -Descending | Select-Object -First 1\n\n# \u8b80\u53d6\u65e5\u8a8c\u6a94\u6848\n$logContent = Get-Content $latestLog.FullName\n\n# \u8a08\u7b97\u8acb\u6c42\u6578\u91cf\n$requestCount = $logContent.Count\n\n# \u8f38\u51fa\u8acb\u6c42\u6578\u91cf\nWrite-Host \"\u6700\u65b0\u65e5\u8a8c\u6a94\u6848\u7684\u8acb\u6c42\u6578\u91cf: $requestCount\"\n<\/code><\/pre>\n<p>\u9019\u6bb5\u8173\u672c\u6703\u81ea\u52d5\u67e5\u627e\u6700\u65b0\u7684\u65e5\u8a8c\u6a94\u6848\u4e26\u8a08\u7b97\u8acb\u6c42\u7684\u6578\u91cf\u3002\u60a8\u53ef\u4ee5\u6839\u64da\u9700\u8981\u9032\u4e00\u6b65\u64f4\u5c55\u6b64\u8173\u672c\uff0c\u4ee5\u7372\u53d6\u66f4\u8a73\u7d30\u7684\u6578\u64da\u3002<\/p>\n<h2 id=\"%e4%bd%bf%e7%94%a8-performance-monitor-%e7%9b%a3%e6%8e%a7-iis-vCbqtPnCfi\">\u4f7f\u7528 Performance Monitor \u76e3\u63a7 IIS<\/h2>\n<p>\u9664\u4e86 PowerShell\uff0cWindows \u7684 Performance Monitor \u4e5f\u662f\u4e00\u500b\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u4f86\u76e3\u63a7 IIS \u7684\u6027\u80fd\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u6b65\u9a5f\u4f86\u8a2d\u7f6e Performance Monitor\uff1a<\/p>\n<ol>\n<li>\u6253\u958b Performance Monitor\u3002<\/li>\n<li>\u53f3\u9375\u9ede\u64ca\u5de6\u5074\u7684 &#8220;Performance Monitor&#8221;\uff0c\u9078\u64c7 &#8220;Add Counters&#8221;\u3002<\/li>\n<li>\u5728 &#8220;Available counters&#8221; \u4e2d\uff0c\u9078\u64c7 &#8220;Web Service&#8221; \u985e\u5225\uff0c\u7136\u5f8c\u9078\u64c7\u60a8\u60f3\u8981\u76e3\u63a7\u7684\u8a08\u6578\u5668\uff0c\u4f8b\u5982 &#8220;Current Connections&#8221; \u6216 &#8220;Requests\/sec&#8221;\u3002<\/li>\n<li>\u9ede\u64ca &#8220;Add&#8221; \u4e26\u78ba\u5b9a\u3002<\/li>\n<\/ol>\n<p>\u9019\u6a23\uff0c\u60a8\u5c31\u53ef\u4ee5\u5be6\u6642\u76e3\u63a7 IIS \u7684\u6027\u80fd\u6307\u6a19\uff0c\u4e26\u6839\u64da\u9700\u8981\u9032\u884c\u8abf\u6574\u3002<\/p>\n<h2 id=\"%e7%b5%90%e8%ab%96-vCbqtPnCfi\">\u7d50\u8ad6<\/h2>\n<p>\u76e3\u63a7 IIS \u8acb\u6c42\u662f\u78ba\u4fdd\u7db2\u7ad9\u6027\u80fd\u548c\u5b89\u5168\u7684\u91cd\u8981\u6b65\u9a5f\u3002\u901a\u904e\u4f7f\u7528 PowerShell \u8173\u672c\u548c Performance Monitor\uff0c\u60a8\u53ef\u4ee5\u7372\u5f97\u6709\u50f9\u503c\u7684\u6578\u64da\uff0c\u5e6b\u52a9\u60a8\u53ca\u6642\u767c\u73fe\u554f\u984c\u4e26\u9032\u884c\u8abf\u6574\u3002\u7121\u8ad6\u662f\u5c0f\u578b\u7db2\u7ad9\u9084\u662f\u5927\u578b\u61c9\u7528\uff0c\u9019\u4e9b\u76e3\u63a7\u5de5\u5177\u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u5fc5\u8981\u7684\u652f\u6301\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u9ad8\u6548\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002\u7121\u8ad6\u662f\u7db2\u7ad9\u6258\u7ba1\u9084\u662f\u61c9\u7528\u90e8\u7f72\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5206\u4eab\u6709\u6548\u7684IIS\u76e3\u63a7\u8acb\u6c42\u8173\u672c\uff0c\u5e6b\u52a9\u512a\u5316\u7db2\u7ad9\u6027\u80fd\uff0c\u63d0\u5347\u4f3a\u670d\u5668\u7ba1\u7406\u6548\u7387\uff0c\u78ba\u4fdd\u7a69\u5b9a\u904b\u884c\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-48826","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48826","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=48826"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48826\/revisions"}],"predecessor-version":[{"id":48827,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48826\/revisions\/48827"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=48826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=48826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=48826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}