IIS 7, HttpHandler and HTTP Error 500.21

后端 未结 7 832
既然无缘
既然无缘 2020-12-09 17:40

On IIS 7, I\'m trying to use custom HttpHandler for my ASP.NET web application. I use pipeline mode \"classic\", .NET version is 4.0.30319, my web.config configuration for t

相关标签:
7条回答
  • 2020-12-09 17:52

    Luckily, it’s very easy to resolve. Run the follow command from an elevated command prompt:

    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
    

    If you’re on a 32-bit machine, you may have to use the following:

    %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
    
    0 讨论(0)
  • 2020-12-09 17:54

    On windows server 2016 i have used:

    dism /online /enable-feature /featurename:IIS-ASPNET45 /all

    Also can be done via Powershell:

    Install-WindowsFeature .NET-Framework-45-Features

    0 讨论(0)
  • 2020-12-09 18:00

    It's not possible to configure an IIS managed handler to run in classic mode. You should be running IIS in integrated mode if you want to do that.

    You can learn more about modules, handlers and IIS modes in the following blog post:

    IIS 7.0, ASP.NET, pipelines, modules, handlers, and preconditions

    For handlers, if you set preCondition="integratedMode" in the mapping, the handler will only run in integrated mode. On the other hand, if you set preCondition="classicMode" the handler will only run in classic mode. And if you omit both of these, the handler can run in both modes, although this is not possible for a managed handler.

    0 讨论(0)
  • 2020-12-09 18:01

    One solution that I've found is that you should have to change the .Net Framework back to v2.0 by Right Clicking on the site that you have manager under the Application Pools from the Advance Settings.

    0 讨论(0)
  • 2020-12-09 18:06

    I had the same problem and just solved it. I had posted my own question on stackoverflow:

    Can't PUT to my IHttpHandler, GET works fine

    The solution was to set runManagedModulesForWebDavRequests to true in the modules element. My guess is that once you install WebDAV then all PUT requests are associated with it. If you need the PUT to go to your handler, you need to remove the WebDAV module and set this attribute to true.

    <modules runManagedModulesForWebDavRequests="true">
    ...
    </modules>
    

    So if you're running into the problem when you use the PUT verb and you have installed WebDAV then hopefully this solution will fix your problem.

    0 讨论(0)
  • 2020-12-09 18:17

    I had the same problem and was solved by running the following in run

    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

    0 讨论(0)
提交回复
热议问题