{"id":12274,"date":"2021-09-09T13:07:22","date_gmt":"2021-09-09T05:07:22","guid":{"rendered":"http:\/\/blog.idc.net\/12274\/"},"modified":"2022-04-25T15:23:41","modified_gmt":"2022-04-25T07:23:41","slug":"iis7-5%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e6%b1%a0%e9%9b%86%e6%88%90%e6%a8%a1%e5%bc%8f%e5%92%8c%e7%bb%8f%e5%85%b8%e6%a8%a1%e5%bc%8f%e7%9a%84%e5%8c%ba%e5%88%ab%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/12274\/","title":{"rendered":"IIS7.5\u5e94\u7528\u7a0b\u5e8f\u6c60\u96c6\u6210\u6a21\u5f0f\u548c\u7ecf\u5178\u6a21\u5f0f\u7684\u533a\u522b\u4ecb\u7ecd"},"content":{"rendered":"<div class=\"idc_table\">\n<p>\u5728 IIS 7.5 \u4e2d\uff0c\u5e94\u7528\u7a0b\u5e8f\u6c60\u6709\u4e24\u79cd\u8fd0\u884c\u6a21\u5f0f\uff1a\u96c6\u6210\u6a21\u5f0f\u548c\u7ecf\u5178\u6a21\u5f0f\u3002<\/p>\n<p>\u5e94\u7528\u7a0b\u5e8f\u6c60\u6a21\u5f0f\u4f1a\u5f71\u54cd\u670d\u52a1\u5668\u5904\u7406\u6258\u7ba1\u4ee3\u7801\u8bf7\u6c42\u7684\u65b9\u5f0f\u3002<\/p>\n<p>\u5982\u679c\u6258\u7ba1\u5e94\u7528\u7a0b\u5e8f\u5728\u91c7\u7528\u96c6\u6210\u6a21\u5f0f\u7684\u5e94\u7528\u7a0b\u5e8f\u6c60\u4e2d\u8fd0\u884c\uff0c\u670d\u52a1\u5668\u5c06\u4f7f\u7528 IIS \u548c ASP.NET \u7684\u96c6\u6210\u8bf7\u6c42\u5904\u7406\u7ba1\u9053\u6765\u5904\u7406\u8bf7\u6c42\u3002<\/p>\n<p>\u5982\u679c\u6258\u7ba1\u5e94\u7528\u7a0b\u5e8f\u5728\u91c7\u7528\u7ecf\u5178\u6a21\u5f0f\u7684\u5e94\u7528\u7a0b\u5e8f\u6c60\u4e2d\u8fd0\u884c\uff0c\u670d\u52a1\u5668\u4f1a\u7ee7\u7eed\u901a\u8fc7 Aspnet_isapi.dll \u8def\u7531\u6258\u7ba1\u4ee3\u7801\u8bf7\u6c42\uff0c\u5176\u5904\u7406\u8bf7\u6c42\u7684\u65b9\u5f0f\u5c31\u50cf\u5e94\u7528\u7a0b\u5e8f\u5728 IIS 6.0 \u4e2d\u8fd0\u884c\u4e00\u6837\u3002<\/p>\n<p><strong>\u7ecf\u5178\u6a21\u5f0f\uff1a<\/strong><\/p>\n<p>\u3000\u3000\u6307\u7684\u662f\u4e0eIIS 6\u6216\u8005\u4e4b\u524d\u7248\u672c\u4fdd\u6301\u517c\u5bb9\u7684\u4e00\u79cd\u6a21\u5f0f\uff0c\u4e00\u4e2a\u5178\u578b\u95ee\u9898\u5c31\u662f\uff0c\u5728\u5904\u7406ASP.NET\u8fd9\u79cd\u52a8\u6001\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u5b83\u662f\u901a\u8fc7\u4e00\u4e2a\u6240\u8c13\u7684ISAPI\u7a0b\u5e8f\uff0c\u4f5c\u4e3a\u63d2\u4ef6\u7684\u65b9\u5f0f\u6765\u5de5\u4f5c\u7684\u3002\u9488\u5bf9\u4e0d\u540c\u7684\u52a8\u6001\u5e94\u7528\u7a0b\u5e8f\uff08\u4f8b\u5982ASP,PHP\u7b49\uff09\uff0c\u4f1a\u9700\u8981\u4e0d\u540c\u7684ISAPI\u3002<\/p>\n<p><strong>\u96c6\u6210\u6a21\u5f0f\uff1a<\/strong><\/p>\n<p>\u3000\u3000\u8fd9\u79cd\u5168\u65b0\u7684\u6a21\u5f0f\uff0c\u5141\u8bb8\u6211\u4eec\u5c06ASP.NET\u66f4\u597d\u5730\u4e0eIIS\u96c6\u6210\uff0c\u751a\u81f3\u5141\u8bb8\u6211\u4eec\u5728ASP.NET\u4e2d\u7f16\u5199\u4e00\u4e9b\u529f\u80fd\uff08\u4f8b\u5982Module\uff09\u6765\u6539\u53d8IIS\u7684\u884c\u4e3a\uff08\u6269\u5c55\uff09\u3002\u96c6\u6210\u7684\u597d\u5904\u662f\uff0c\u4e0d\u518d\u901a\u8fc7ISAPI\u7684\u65b9\u5f0f\uff0c\u63d0\u9ad8\u4e86\u901f\u5ea6\u548c\u7a33\u5b9a\u6027\u3002\u81f3\u4e8e\u6269\u5c55\uff0c\u5219\u53ef\u4ee5\u4f7f\u5f97\u6211\u4eec\u5bf9\u4e8eIIS\u4ee5\u53ca\u5176\u4ed6\u7c7b\u578b\u7684\u8bf7\u6c42\u6709\u66f4\u591a\u7684\u63a7\u5236\u3002<\/p>\n<p>\u5347\u7ea7\u8fc7\u7a0b\u4e2d\u51fa\u73b0\u4e86\u6bd4\u8f83\u591a\u7684\u95ee\u9898\uff0c\u524d\u9762\u6587\u7ae0\u4e5f\u63d0\u5230\u8fc7\u51e0\u4e2a\u3002\u8fd9\u6b21\u5c31\u4e3b\u8981\u4ecb\u7ecd\u4e0bhttpHandler \u548c httpModule \u5728\u96c6\u6210\u548c\u7ecf\u5178\u6a21\u5f0f\u4e0b\u7684\u533a\u522b\u3002\u5f88\u591a\u6587\u4ef6\u4e0a\u4f20\u7b49\u90fd\u662f\u9700\u8981\u4f7f\u7528\u5230httpModule\u53bb\u5b9e\u73b0\u3002\u6211\u4eca\u5929\u5c31\u51fa\u73b0\u4e86NeatUpload\u5728iis7.5\u4e0b\u51fa\u73b0\u672a\u5c06\u5bf9\u8c61\u5f15\u7528\u5230\u8bbe\u8ba1\u5b9e\u4f8b\u7684\u9519\u8bef\u3002\u6240\u4ee5\u7528httpModule\u4f5c\u4e3a\u6d4b\u8bd5\u6848\u4f8b\u3002 <\/p>\n<p> 1.\u65b0\u5efa\u6d4b\u8bd5\u7f51\u7ad9WebApplication\uff0c\u52a0\u5165MyHttpModule\u7c7b\u5b9e\u73b0IHttpModule\u63a5\u53e3\uff0c\u4e3b\u8981\u76ee\u7684\u662f\u6d4b\u8bd5\u7a0b\u5e8f\u662f\u5426\u7ecf\u8fc7\u4e86HttpModule\uff0c\u7ecf\u8fc7\u7684\u5728\u9875\u9762\u8f93\u51faHttpModule\u5b57\u7b26\u3002<\/p>\n<pre>\npublic class MyHttpModule : IHttpModule \n{ \npublic void Dispose() \n{ \n} \npublic void Init(HttpApplication context) \n{ \ncontext.BeginRequest += context_BeginRequest; \n} \nprotected void context_BeginRequest(object sender, EventArgs e) \n{ \nvar context = sender as HttpApplication; \ncontext.Response.Clear(); \ncontext.Response.Write(\"HttpModule\"); \ncontext.Response.End(); \n} \n} \n<\/pre>\n<p> 2\u30012.\u5728IIS7.5\u90e8\u7f72\u7f51\u7ad9\uff0c\u9996\u5148\u4f7f\u7528\u7ecf\u5178\u6a21\u5f0f\u5e94\u7528\u7a0b\u5e8f\u6c60\u3002\u5728web.config\u7684 &lt;system.web&gt; \u7684\u5b50\u8282\u70b9&lt;httpModules&gt; \u52a0\u5165&lt;add name=\"MyHttpModule\" type=\"WebApplication.MyHttpModule, WebApplication\"\/&gt;<\/p>\n<pre>\n&lt;httpHandlers&gt; \n&lt;remove verb=\"*\" path=\"*.asmx\"\/&gt; \n&lt;add verb=\"*\" path=\"*.asmx\" validate=\"false\" type=\"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\/&gt; \n&lt;add verb=\"*\" path=\"*_AppService.axd\" validate=\"false\" type=\"System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\/&gt; \n&lt;add verb=\"GET,HEAD\" path=\"ScriptResource.axd\" type=\"System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" validate=\"false\"\/&gt; \n&lt;\/httpHandlers&gt; \n&lt;httpModules&gt; \n&lt;add name=\"MyHttpModule\" type=\"WebApplication.MyHttpModule, WebApplication\"\/&gt; \n&lt;add name=\"ScriptModule\" type=\"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\/&gt; \n&lt;\/httpModules&gt; <\/pre>\n<p> \u8bbf\u95ee\u7f51\u7ad9\u53ef\u4ee5\u53d1\u73b0\u9875\u9762\u8f93\u51fa\u5982\u4e0b\uff0c\u8bf4\u660e\u7a0b\u5e8f\u7ecf\u8fc7\u4e86HttpModule<\/p>\n<p><a href=\"http:\/\/blog.idc.net\/wp-content\/uploads\/2022\/04\/151721-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18546\" src=\"http:\/\/blog.idc.net\/wp-content\/uploads\/2022\/04\/151721-1.png\" width=\"275\" height=\"74\" \/><\/a><\/p>\n<p>\u76f4\u63a5\u5207\u6362\u5e94\u7528\u7a0b\u5e8f\u6c60\u6210\u96c6\u6210\u6a21\u5f0f\u4f1a\u53d1\u73b0\u9875\u9762\u8f93\u51fa\u4e3a\u7a7a\u3002\u8bc1\u660e\u7a0b\u5e8f\u6ca1\u6709\u7ecf\u8fc7HttpModule\u3002\u90a3\u5728\u96c6\u6210\u6a21\u5f0f\u4e0bHttpModule\u5982\u4f55\u624d\u80fd\u6267\u884c\u5462\uff1f \u4e4b\u524d\u90e8\u7f72<span><span>URLRewriter\u7684\u65f6\u5019\u67e5\u8d44\u6599\u53ea\u77e5\u9053\u9700\u8981&nbsp;&lt;system.webServer&gt;&nbsp;&lt;modules&gt;\u6ce8\u518cHttpModule\u3002\u4ed4\u7ec6\u67e5\u770b\u914d\u7f6e\u6587\u4ef6\u4f1a\u53d1\u73b0\u6709\u4e00\u6bb5\u5982\u4e0b\u82f1\u6587.\u610f\u601d\u5927\u6982\u5c31\u662fiis7\u7248\u672c\u7684\u8bbe\u7f6e\u3002\u4e4b\u524d\u7248\u672c\u65e0\u9700\u8bbe\u7f6e\u3002<\/span><\/span><br \/> &lt;!-- <br \/> The system.webServer section is required for running ASP.NET AJAX under Internet <br \/> Information Services 7.0. It is not necessary for previous version of IIS. <br \/> --&gt; <br \/> \u8fd9\u6837\u5c31\u5927\u6982\u660e\u767d\u610f\u601d\u662fiis7.0\u4e4b\u540e\u6709\u90e8\u5206web\u914d\u7f6e\u79fb\u52a8\u5230system.webServer\u4e2d\u3002\u67e5\u9605\u76f8\u5173\u5f97\u5230\u7b54\u6848\u786e\u5b9e\u5982\u6b64 \u8be6\u7ec6\u8d44\u6599\u89c1 http:\/\/www.cnblogs.com\/buaaboyi\/archive\/2011\/01\/20\/1939903.html <\/p>\n<p> \u4e8e\u662f\u5728&lt;system.webServer&gt; &lt;modules&gt;\u4e2d\u52a0\u5165\u914d\u7f6e\u5982\u4e0b\uff0c\u5237\u65b0\u9875\u9762\uff0c\u9875\u9762\u80fd\u591f\u8f93\u51fa\u5b57\u7b26HttpModule\uff0c\u8bc1\u660e\u6210\u529f\u4e86\u3002  <\/p>\n<pre>\n&lt;system.webServer&gt; \n&lt;validation validateIntegratedModeConfiguration=\"false\"\/&gt; \n&lt;modules&gt; \n&lt;remove name=\"ScriptModule\" \/&gt; \n&lt;add name=\"MyHttpModule\" type=\"WebApplication.MyHttpModule, WebApplication\"\/&gt; \n&lt;add name=\"ScriptModule\" preCondition=\"managedHandler\" type=\"System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\/&gt; \n&lt;\/modules&gt;<\/pre>\n<p>\u7531\u4e8e\u5728\u5347\u7ea7\u8fc7\u7a0b\u6210\u6709\u4e00\u4e2a\u7ad9\u70b9\u51fa\u73b0 HTTP \u9519\u8bef 500.22 - Internal Server Error \u68c0\u6d4b\u5230\u5728\u96c6\u6210\u7684\u6258\u7ba1\u7ba1\u9053\u6a21\u5f0f\u4e0b\u4e0d\u9002\u7528\u7684 ASP.NET \u8bbe\u7f6e  <\/p>\n<p><a href=\"http:\/\/blog.idc.net\/wp-content\/uploads\/2022\/04\/151722.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-18547\" src=\"http:\/\/blog.idc.net\/wp-content\/uploads\/2022\/04\/151722.png\" width=\"532\" height=\"125\" srcset=\"https:\/\/idc.net\/help\/wp-content\/uploads\/2022\/04\/151722.png 532w, https:\/\/idc.net\/help\/wp-content\/uploads\/2022\/04\/151722-300x70.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/a><br \/> \u5f53\u65f6\u5728\u6bd4\u8f83\u6025\u7684\u60c5\u51b5\u4e0b\u5c31\u76f4\u63a5\u5220\u9664\u4e86 &lt;system.web&gt; \u7684\u5b50\u8282\u70b9&lt;httpModules&gt; \u7a0b\u5e8f\u6b63\u5e38\u8fd0\u884c\u3002\u540e\u9762\u901a\u8fc7\u4ed4\u7ec6\u548c\u6b63\u5e38\u7684\u7ad9\u70b9\u5bf9\u6bd4\u662f\u53d1\u73b0\u662f\u7f3a\u5c11 &lt;validation validateIntegratedModeConfiguration=\"false\"\/&gt; \u8fd9\u4e2a\u5bfc\u81f4\uff0c\u8fd9\u4e2a\u4e3b\u8981\u4f5c\u7528\u662f\u8bbe\u7f6e\u4e0d\u68c0\u6d4b &lt;system.web&gt;\u4e2d\u7684\u914d\u7f6e <\/p>\n<p> \u7ecf\u8fc7\u8fd9\u4eca\u5929\u7684\u6298\u817e\u7ec8\u4e8e\u662f\u5bf9iis7.5\u4e0a\u7684\u90e8\u7f72\u6709\u4e86\u4e00\u5b9a\u4e86\u89e3\u4e86\u3002<\/p>\n<p><span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 IIS 7.5 \u4e2d\uff0c\u5e94\u7528\u7a0b\u5e8f\u6c60\u6709\u4e24\u79cd\u8fd0\u884c\u6a21\u5f0f\uff1a\u96c6\u6210\u6a21\u5f0f\u548c\u7ecf\u5178\u6a21\u5f0f\u3002 \u5e94\u7528\u7a0b\u5e8f\u6c60\u6a21\u5f0f\u4f1a\u5f71\u54cd\u670d\u52a1\u5668\u5904\u7406\u6258\u7ba1\u4ee3\u7801 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,26],"tags":[],"class_list":["post-12274","post","type-post","status-publish","format-standard","hentry","category-iis","category-windows"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/12274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=12274"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/12274\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=12274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=12274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=12274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}