문제

추가 한 MVC4 응용 프로그램이 있습니다. HttpHandler:

<system.web>
    ...
    <httpHandlers>
        <add path="Files" verb="*" type="MyHttpHandler" />
    </httpHandlers>
</system.web>

또한 관련 경로를 무시했습니다 RegisterRoutes "파일"에 대한 요청은 MVC에 의해 처리되지 않습니다.

routes.IgnoreRoute("Files/{*pathInfo}");

문제는 MyHttpHandler 자녀 나 하위 폴더가 아닌 "파일"에 대한 요청에 대해서만 호출됩니다.

나는 그것을 사용했다 <location> 요소이지만이를 작동시키는 것은 "Path"속성 (예 : G, <location path='MyApp\Files'>).

"파일"에 대한 모든 요청과 하위 폴더 (및 해당 폴더의 하위 폴더 등)에 대한 모든 요청을 허용하는 데 사용하는 올바른 방법은 무엇입니까? MyHttpHandler?

도움이 되었습니까?

해결책

긁어 ...<location> 잘 작동하는 것 같습니다. 하지만 둘 다 필요합니다 <web> 그리고 <webServer> IIS와 Visual Studio Development Server 모두에서 작동하는지 확인하기위한 항목. 예를 들어:

<location path="Files">`
    <system.webServer>
        <handlers>
            <add name="MyHandler" path="*" verb="*" type="MyHttpHandler" />
        </handlers>
    </system.webServer>
    <system.web>
        <httpHandlers>
            <add path="*" verb="*" type="MyHttpHandler" />
        </httpHandlers>
    </system.web>
</location>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top