{"id":48382,"date":"2024-10-07T20:54:13","date_gmt":"2024-10-07T12:54:13","guid":{"rendered":"https:\/\/server.hk\/cnblog\/48382\/"},"modified":"2024-10-07T20:54:13","modified_gmt":"2024-10-07T12:54:13","slug":"iis-%e5%85%a5%e9%96%80%ef%bc%9a%e7%82%ba%e5%9c%96%e5%83%8f%e5%ba%ab%e5%af%a6%e6%96%bd-iis","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/48382\/","title":{"rendered":"IIS \u5165\u9580\uff1a\u70ba\u5716\u50cf\u5eab\u5be6\u65bd IIS"},"content":{"rendered":"<h1 id=\"iis-%e5%85%a5%e9%96%80%ef%bc%9a%e7%82%ba%e5%9c%96%e5%83%8f%e5%ba%ab%e5%af%a6%e6%96%bd-iis-JmzgPAkTXy\">IIS \u5165\u9580\uff1a\u70ba\u5716\u50cf\u5eab\u5be6\u65bd IIS<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u6578\u4f4d\u6642\u4ee3\uff0c\u5716\u50cf\u5eab\u6210\u70ba\u4e86\u8a31\u591a\u7db2\u7ad9\u7684\u91cd\u8981\u7d44\u6210\u90e8\u5206\u3002\u7121\u8ad6\u662f\u85dd\u8853\u4f5c\u54c1\u3001\u7522\u54c1\u5c55\u793a\u9084\u662f\u500b\u4eba\u76f8\u518a\uff0c\u5716\u50cf\u5eab\u90fd\u80fd\u6709\u6548\u5730\u5438\u5f15\u8a2a\u5ba2\u7684\u6ce8\u610f\u529b\u3002\u70ba\u4e86\u5be6\u73fe\u9ad8\u6548\u7684\u5716\u50cf\u5eab\u7ba1\u7406\uff0c\u4f7f\u7528 Internet Information Services (IIS) \u662f\u4e00\u500b\u4e0d\u932f\u7684\u9078\u64c7\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 IIS \u4e0a\u5be6\u65bd\u5716\u50cf\u5eab\uff0c\u4e26\u63d0\u4f9b\u4e00\u4e9b\u5be6\u7528\u7684\u6280\u5de7\u548c\u7bc4\u4f8b\u3002<\/p>\n<h2 id=\"iis-%e7%b0%a1%e4%bb%8b-JmzgPAkTXy\">IIS \u7c21\u4ecb<\/h2>\n<p>IIS \u662f\u5fae\u8edf\u958b\u767c\u7684\u4e00\u6b3e\u7db2\u9801\u4f3a\u670d\u5668\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc Windows \u74b0\u5883\u4e2d\u3002\u5b83\u652f\u6301\u591a\u7a2e\u7db2\u9801\u6280\u8853\uff0c\u5305\u62ec ASP.NET\u3001PHP \u548c HTML\uff0c\u4e26\u63d0\u4f9b\u4e86\u5f37\u5927\u7684\u5b89\u5168\u6027\u548c\u6027\u80fd\u512a\u5316\u529f\u80fd\u3002\u5c0d\u65bc\u9700\u8981\u7ba1\u7406\u5927\u91cf\u5716\u50cf\u7684\u7db2\u7ad9\u4f86\u8aaa\uff0cIIS \u63d0\u4f9b\u4e86\u9748\u6d3b\u7684\u914d\u7f6e\u9078\u9805\u548c\u9ad8\u6548\u7684\u8cc7\u6e90\u7ba1\u7406\u80fd\u529b\u3002<\/p>\n<h2 id=\"%e5%ae%89%e8%a3%9d-iis-JmzgPAkTXy\">\u5b89\u88dd IIS<\/h2>\n<p>\u5728 Windows \u7cfb\u7d71\u4e2d\u5b89\u88dd IIS \u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li>\u6253\u958b\u300c\u63a7\u5236\u9762\u677f\u300d\uff0c\u9078\u64c7\u300c\u7a0b\u5f0f\u300d\u3002<\/li>\n<li>\u9ede\u64ca\u300c\u555f\u7528\u6216\u95dc\u9589 Windows \u529f\u80fd\u300d\u3002<\/li>\n<li>\u5728\u5f48\u51fa\u7684\u7a97\u53e3\u4e2d\uff0c\u627e\u5230\u300cInternet Information Services\u300d\uff0c\u52fe\u9078\u5b83\u4e26\u9ede\u64ca\u300c\u78ba\u5b9a\u300d\u3002<\/li>\n<li>\u7b49\u5f85\u5b89\u88dd\u5b8c\u6210\uff0c\u7136\u5f8c\u91cd\u555f\u96fb\u8166\u3002<\/li>\n<\/ol>\n<h2 id=\"%e9%85%8d%e7%bd%ae-iis-%e4%bb%a5%e6%94%af%e6%8c%81%e5%9c%96%e5%83%8f%e5%ba%ab-JmzgPAkTXy\">\u914d\u7f6e IIS \u4ee5\u652f\u6301\u5716\u50cf\u5eab<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u914d\u7f6e IIS \u4ee5\u652f\u6301\u5716\u50cf\u5eab\u7684\u904b\u884c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u57fa\u672c\u7684\u914d\u7f6e\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-%e5%89%b5%e5%bb%ba%e7%b6%b2%e7%ab%99-JmzgPAkTXy\">1. \u5275\u5efa\u7db2\u7ad9<\/h3>\n<p>\u5728 IIS \u7ba1\u7406\u5668\u4e2d\uff0c\u53f3\u9375\u9ede\u64ca\u300c\u7db2\u7ad9\u300d\uff0c\u9078\u64c7\u300c\u6dfb\u52a0\u7db2\u7ad9\u300d\u3002\u586b\u5beb\u7db2\u7ad9\u540d\u7a31\u3001\u7269\u7406\u8def\u5f91\uff08\u6307\u5411\u60a8\u7684\u5716\u50cf\u5eab\u6587\u4ef6\u593e\uff09\u548c\u7aef\u53e3\u865f\uff0c\u7136\u5f8c\u9ede\u64ca\u300c\u78ba\u5b9a\u300d\u3002<\/p>\n<h3 id=\"2-%e8%a8%ad%e7%bd%ae-mime-%e9%a1%9e%e5%9e%8b-JmzgPAkTXy\">2. \u8a2d\u7f6e MIME \u985e\u578b<\/h3>\n<p>\u70ba\u4e86\u78ba\u4fdd IIS \u80fd\u5920\u6b63\u78ba\u8655\u7406\u5404\u7a2e\u5716\u50cf\u683c\u5f0f\uff0c\u60a8\u9700\u8981\u8a2d\u7f6e MIME \u985e\u578b\u3002\u53f3\u9375\u9ede\u64ca\u60a8\u7684\u7db2\u7ad9\uff0c\u9078\u64c7\u300c\u5c6c\u6027\u300d\uff0c\u7136\u5f8c\u5728\u300cHTTP \u982d\u300d\u9078\u9805\u5361\u4e2d\u6dfb\u52a0\u4ee5\u4e0b MIME \u985e\u578b\uff1a<\/p>\n<ul>\n<li>JPEG: image\/jpeg<\/li>\n<li>PNG: image\/png<\/li>\n<li>GIF: image\/gif<\/li>\n<\/ul>\n<h3 id=\"3-%e9%85%8d%e7%bd%ae%e6%ac%8a%e9%99%90-JmzgPAkTXy\">3. \u914d\u7f6e\u6b0a\u9650<\/h3>\n<p>\u78ba\u4fdd IIS \u7528\u6236\u5c0d\u5716\u50cf\u5eab\u6587\u4ef6\u593e\u64c1\u6709\u8b80\u53d6\u6b0a\u9650\u3002\u53f3\u9375\u9ede\u64ca\u6587\u4ef6\u593e\uff0c\u9078\u64c7\u300c\u5c6c\u6027\u300d\uff0c\u7136\u5f8c\u5728\u300c\u5b89\u5168\u6027\u300d\u9078\u9805\u5361\u4e2d\u6dfb\u52a0\u300cIIS_IUSRS\u300d\u7528\u6236\u4e26\u8ce6\u4e88\u8b80\u53d6\u6b0a\u9650\u3002<\/p>\n<h2 id=\"%e5%af%a6%e6%96%bd%e5%9c%96%e5%83%8f%e5%ba%ab%e5%8a%9f%e8%83%bd-JmzgPAkTXy\">\u5be6\u65bd\u5716\u50cf\u5eab\u529f\u80fd<\/h2>\n<p>\u4e00\u65e6 IIS \u914d\u7f6e\u5b8c\u6210\uff0c\u60a8\u53ef\u4ee5\u958b\u59cb\u5be6\u65bd\u5716\u50cf\u5eab\u7684\u529f\u80fd\u3002\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684 ASP.NET \u793a\u4f8b\uff0c\u5c55\u793a\u5982\u4f55\u5f9e\u8cc7\u6599\u593e\u4e2d\u52a0\u8f09\u5716\u50cf\uff1a<\/p>\n<pre><code>\nusing System;\nusing System.IO;\nusing System.Web.UI;\n\npublic partial class ImageGallery : Page\n{\n    protected void Page_Load(object sender, EventArgs e)\n    {\n        string[] images = Directory.GetFiles(Server.MapPath(\"~\/Images\"));\n        foreach (string image in images)\n        {\n            Image img = new Image();\n            img.ImageUrl = \"~\/Images\/\" + Path.GetFileName(image);\n            img.Width = 200;\n            img.Height = 200;\n            ImagePanel.Controls.Add(img);\n        }\n    }\n}\n<\/code><\/pre>\n<p>\u5728\u9019\u500b\u793a\u4f8b\u4e2d\uff0c\u6211\u5011\u5f9e\u6307\u5b9a\u7684\u5716\u50cf\u6587\u4ef6\u593e\u4e2d\u52a0\u8f09\u6240\u6709\u5716\u50cf\u4e26\u986f\u793a\u5728\u7db2\u9801\u4e0a\u3002\u60a8\u53ef\u4ee5\u6839\u64da\u9700\u8981\u9032\u4e00\u6b65\u81ea\u5b9a\u7fa9\u6a23\u5f0f\u548c\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-JmzgPAkTXy\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5728 IIS \u4e0a\u6210\u529f\u5be6\u65bd\u5716\u50cf\u5eab\uff0c\u4e26\u70ba\u60a8\u7684\u7db2\u7ad9\u63d0\u4f9b\u9ad8\u6548\u7684\u5716\u50cf\u7ba1\u7406\u529f\u80fd\u3002\u7121\u8ad6\u662f\u500b\u4eba\u9805\u76ee\u9084\u662f\u5546\u696d\u7db2\u7ad9\uff0cIIS \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f\u642d\u5efa\u7db2\u7ad9\u9084\u662f\u7ba1\u7406\u5716\u50cf\u5eab\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u5c07\u662f\u6210\u529f\u7684\u95dc\u9375\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u70ba\u5716\u50cf\u5eab\u5be6\u65bdIIS\uff0c\u638c\u63e1\u57fa\u672c\u8a2d\u5b9a\u8207\u6700\u4f73\u5be6\u8e10\uff0c\u63d0\u5347\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-48382","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48382","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=48382"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48382\/revisions"}],"predecessor-version":[{"id":48383,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/48382\/revisions\/48383"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=48382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=48382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=48382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}