Custom Http Handlers IIS7 and ASP.NET

后端 未结 2 1221
长情又很酷
长情又很酷 2020-12-19 02:48

We have some HTTP handlers specified in our web.config. When we were running this site via a Web Site Project, all worked fine. But for some reason, after porting this ove

相关标签:
2条回答
  • 2020-12-19 03:23

    For ASP.NET applications running on IIS7, HttpHandlers should be mapped in the <system.webServer> section of your web.config. In IIS6, they were mapped in the <system.web> section.

    <system.webServer>
        <handlers>
            <add name="HandlerName" 
                 path="HandlerPath" verb="*" type="Handler.Type"
                 resourceType="Unspecified" />
        </handlers>
    </system.webServer>
    
    0 讨论(0)
  • 2020-12-19 03:24

    What you need to do is build your code.

    You need to copy all the C# code out into a .ashx.cs file. In fact, I recommend you create a new .ashx and copy the C# code into its .ashx.cs file.

    Web sites build dynamically. Web Application Projects, like every other similar project type in Visual Studio, need to have code in source files, and to have that code build into an assembly.

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