???? ID: 308001 - ????? ???????: 29 ??????? 2010 - ??????: 4.0

????? C# .NET ?? ????? ?? ???? asp.NET HTTP ?????? ?? ????? ???? ????

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

??? ?? ??????? ???? | ??? ?? ??????? ????
?? ??? ?? ??? ???? ????????? ???? ?? ?? ??????, ????? HTTP ?????? ????? ?? ??? ????? C# .NET ?? ????? ???? ????? ?? ???? ????????? ???? ?? ?? ???? ?????, ?????? ????, ?? ?????? ???????? ?????

???? ???????

?????? ??????????? ????

  1. Microsoft Visual Studio .NET ?????? ????? C# .NET, ??? ?? ?? ????? ????????? ????????? MyHandler ??? ??????
  2. ???? ?????? ?? ??? ??? ????System.web.dll????????
  3. ???? ?? ??? ????? directive ??????:
    using System.Web;
    					
  4. ???? SyncHandler.cs ?? ??? ?????, ?? ?? ???? ??????? ?? ?? ?????? ?? ??? ????????? ?????
  5. ImplementIHttpHandler???????? ??? ???? ???? ??????? ?? ??? ??? ????? ???? ?????:
    public class SyncHandler : IHttpHandler
    					
  6. ImplementIsReusable??? ??ProcessRequest?? ??? ????IHttpHandler???????? ??? ??????? ?? ???? ????????? ?????? ??, ?? ???? ?????????? ???IsReusable??? ?? ?????? pooled ???? ???
    public bool IsReusable
    {
       get {return false;}
    }
    
    public void ProcessRequest(HttpContext context)
    {
       context.Response.Write("Hello from custom handler.");
    }
    					
  7. ????????? ?? ??????? ?????

?????? ?????? ????

  1. ??? ?? ?????????? C:\Inetpub\Wwwroot ?????????? ?? ??????? ?????? ?? ??? ??????
  2. ?? ???? ?? ?????? ?????????? ??? ??? ??? ??? ?? subdirectory ?????? ??????? ?? ??? C:\Inetpub\Wwwroot\Handler\Bin ???
  3. C:\Inetpub\Wwwroot\Handler\Bin ?????????? ?? ???? ????????? Bin\Debug ?????????? ?? MyHandler.dll ?? ????????? ??????
  4. ??? ?????? ?????????? ?? ???? ??? ????????? ?? ??? ??? ??????? ???? ?? ???, ????? ????? ?? ???? ????:
    1. ??????? ???? ??????? ??????
    2. ?????? ?????????? ?? ????-????? ????, ?? ???? ??? ????? ???????.
    3. ????? ????????????????? ??,?????.
  5. ?????? ?? ??? ??? ????????? ?????? ????? ?? ???, ????? ????? ?? ???? ????? ?? ?????? ?? ??? ??? *.sync ????????? ?? ??? Aspnet_isapi.dll ????? ?????? ?????? ??? .sync ????? ?? ?????? ???? ??, ?? ?? ?????? ???? ?? ??? asp.NET, ??? ?? ?? asp.NET ?????? ??? ??? ????????? ???? ???
    1. ?????? ??? ????????? ?? ????-????? ????, ?? ???? ??????.
    2. ????? ????????????????? ??,configuration.
    3. ????? ????,add??? ??? ?????? ???????
    4. ????????????? ???????? ????? ???, ????? ?? ???? ????: Microsoft Windows 2000:
      C:\WINNT\Microsoft.NET\Framework\ <version#>\Aspnet_isapi.dll</version#>
      Microsoft Windows XP:
      C:\WINDOWS\Microsoft.NET\Framework\ <version#>\Aspnet_isapi.dll</version#>
    5. ????????????????? ????? ???, ??????.sync.
    6. ????????? ???? ?? ?????? ???? ?? ???? ????? ????? ????? ????? ??, ?? ???? ??? ????? ????OK??? ???? ?? ???????????? ????????? ?????? ?????/??????? ????????? ????? ?? ??????? ?? ??? ?? ..
    7. ????? ????,OK??? ???? ?? ???????????? ?? ??????????????????? ???????? ????? ????
  6. ??????? ???? ??????? ?? ??? ?????

?????? ?? ???????? ????

  1. C:\Inetpub\Wwwroot\Handler ?????????? ??? Web.config ??? ?? ??? ?? ????? ??????
  2. ????? ??? Web.config ??? ??????:
    <configuration>
       <system.web>
          <httpHandlers>
             <add verb="*" path="*.sync" type="MyHandler.SyncHandler, MyHandler" />
          </httpHandlers>
       </system.web>
    </configuration>
    						
    ??????????? = "*"??????? ?? ???, ???? ?? ?????? (?????? ?? ???, POST, HEAD, GET ?? ??? ???) ?? ????? ???? ?? ?? ?????? ?? ??????? ???? ?? ??? ?????? ?? instruct. ??? ?? ?? ?????? ???? POST ?????? ?? ??????? ???? ?? ??? ????? ???, ????????? ???? ?? ??? ?? ?????????? "POST" =.

    ??????? "*.sync" =???????, ?????? .sync ????????? ???? ??????? ?? ??? ??? ?? ??? ???? ???????? ?? ??????? ???? ?? ??? ?? instruct.

    ?????type="MyHandler.SyncHandler, MyHandler"??????? ??, ?? instruct ?????? ??? ??????????? ???? ?? ??? ?????? ?? ???????? ???? ??MyHandler.SyncHandler??? ?????, ?? ?? ???? ????? ???MyHandler????????

??????? ?? ??????? ????

?? ?????? ?? ??????? ?? ??? ??? ????? ???? ???? ?? ???????? ???? ?????? ??? ????? ??? ?????? ?? ??? ?????? ??? ????????? (http:// <computername>/Handler/Default.sync) ??? Default.sync ????? ?? ?????? ????? ????? ???????? ?? ??????? ???? ?????:</computername>
Hello from custom handler.
				

??????

HTTP handlers ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
307985  (http://support.microsoft.com/kb/307985/EN-US/ ) ?????: asp.NET HTTP ??????? ?? HTTP ???????? ?? ??????

???? ???? ???? ??:
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
  • Microsoft Visual C# .NET 2003 Standard Edition
  • Microsoft Visual C# .NET 2002 Standard Edition
??????: 
kbconfig kbhowtomaster kbhttphandlers kbhttpruntime kbweb kbmt KB308001 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:308001  (http://support.microsoft.com/kb/308001/en-us/ )