2009-09-17 4 views
0

반대쪽에서 처리기를 추가하고 제거하는 차이점은 무엇입니까? 내가 VS2008로 만든 새로운 웹 프로젝트에서 web.config에서 ASP.NET Http 처리기를 등록하는 방법은 여러 가지가 있습니까?

는, 핸들러는이 같이 정의된다 :
<system.web> 
     ... 

     <httpHandlers> 
     <remove verb="*" path="*.asmx"/> 
     <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <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"/> 
     <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"/> 
     <add verb="*" path="/hello/helloworld.xml" type="HandlerTest.HelloWorldHandler, HandlerTest"/> 
     </httpHandlers> 
     <httpModules> 
     <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     </httpModules> 

    </system.web> 

그러나 기존의 프로젝트

는 (즉 : 커뮤니티 서버)는 HTTP 처리기가 추가/제거

<system.webServer> 
     <validation validateIntegratedModeConfiguration="false"/> 
     <security> 
      <requestFiltering allowDoubleEscaping="true"/> 
     </security> 
     <modules runAllManagedModulesForAllRequests="true"> 
      <remove name="CommunityServer"/> 
      <remove name="ScriptModule"/> 
      <remove name="UrlRoutingModule"/> 
      <add name="CommunityServer" type="CommunityServer.CSHttpModule, CommunityServer.Components"/> 
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 
     </modules> 
     <handlers accessPolicy="Read, Write, Script, Execute"> 
      <remove name="WebServiceHandlerFactory-Integrated"/> 
      <remove name="ScriptHandlerFactory"/> 
      <remove name="ScriptHandlerFactoryAppServices"/> 
      <remove name="ScriptResource"/> 


      <add verb="GET" name="redirect" path="Utility/redirect.aspx" type="CommunityServer.Components.Redirect, CommunityServer.Components"/> 
      <add verb="GET" name="aggbug" path="aggbug.aspx" type="CommunityServer.Components.HttpHandler.AggBugHandler, CommunityServer.Components"/> 
      <add verb="GET" name="avatar" path="avatar.aspx" type="CommunityServer.Components.HttpHandler.AvatarHttpHandler, CommunityServer.Components"/> 
      <add verb="GET" name="vcard" path="vcard.aspx" type="CommunityServer.Components.HttpHandler.VCardHttpHandler, CommunityServer.Components"/> 
      <add verb="GET" name="tinyurl" path="r.ashx" type="CommunityServer.Components.HttpHandler.TinyUrlHttpHandler, CommunityServer.Components"/> 
      <add verb="GET" name="weblogsubscription-confirmation" path="weblogsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.WeblogSubscriptionConfirmation, CommunityServer.Blogs"/> 
      <add verb="GET" name="threadsubscription-confirmation" path="threadsubscription-confirmation.ashx" type="CommunityServer.Blogs.Components.ThreadSubscriptionConfirmation, CommunityServer.Blogs"/> 
      <add verb="GET" name="cfs-file" path="cfs-file.ashx" type="CommunityServer.Components.FileHttpHandler, CommunityServer.Components"/> 
      <add verb="GET" name="cfs-filesystemfile" path="cfs-filesystemfile.ashx" type="CommunityServer.Components.FileSystemFileStorageHttpHandler, CommunityServer.Components"/> 
      <add verb="GET" name="resized-image" path="resized-image.ashx" type="CommunityServer.Components.ImageFileResizerHttpHandler, CommunityServer.Components"/> 
      <add verb="GET,POST" name="multipleupload" path="multipleupload.ashx" type="Telligent.Glow.MultipleUploadFileHandler, Telligent.Glow"/> 
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> 
      <add name="TinyMCE" verb="GET,HEAD,POST" path="TinyMCE.ashx" type="Moxiecode.TinyMCE.Web.HttpHandler,Moxiecode.TinyMCE"/> 
     <add name="Schedule" verb="*" path="schedule.ashx" type="CommunityServer.Scheduler.ScheduleHandler, CommunityServer.Scheduler" /> 
    </handlers> 
    </system.webServer> 

http 처리기를 등록하는 방법이 두 가지 이상인 이유는 무엇입니까?

답변

6

<system.web> 섹션은 IIS6 이하에 적용되는 반면 <system.webServer>은 IIS7 이상에 적용됩니다. web.config의 레이아웃은 IIS7에서보다 강력하고 친숙하게 재 설계되었지만 이전 버전과의 호환성은 희생되었습니다.

+1

그렇다면 두 웹 서버에서 앱을 실행하려면 두 개의 web.config가 있어야합니다. – flq

1

'노드'에 게시 한 두 번째 예는 서버를 직접 구성 할 수 있도록 IIS 7을 구성하는 방법입니다. 다른 방법은 "레거시"이며 지원되는 모든 IIS 버전에서 작동합니다.

관련 문제