문제

web.config에서 404 핸들러 페이지를 설정했지만 URL의 확장이 .aspx (또는 ASP.NET에서 처리하는 다른) 일 때만 작동합니다. 웹 사이트 옵션에서 정적 HTML 페이지를 설정할 수는 있지만 페이지를 갖고 싶습니다. IIS의 모든 요청 확장에 ASPX 핸들러 페이지를 할당하는 옵션이 있습니까?

도움이 되었습니까?

해결책

직접적인 질문은 ASPX 핸들러를 모든 요청 확장에 할당하는 옵션이 있는지 여부였습니다. 예, 그렇습니다. 곧 그렇게하는 방법에 대해 논의하겠습니다.

첫째, "숨겨진"질문 (실제로 원하는 대답)은 ASPX, ASMX 등 이외의 페이지에 대해 404 오류를 모두 리디렉션 할 수있는 방법이 있는지 여부라고 생각합니다. 그렇습니다. 더 나은 당신이 가진 문제를 해결할 경우 선택하십시오.

IIS 6의 404를 모두 리디렉션하려면 웹 응용 프로그램 루트 (자체 사이트 또는 기본 사이트의 가상 디렉토리이든)를 마우스 오른쪽 버튼으로 클릭하고 "속성"을 선택하십시오. 거기에서 "사용자 정의 오류"탭을 선택하십시오. 목록에서 404를 찾아 원하는 리디렉션으로 변경하십시오.

이제 충분하지 않다면 - 정말 희망합니다. 예, ASPX 핸들러를 통해 모든 페이지를 실행할 수 있습니다. 그러나 효율성 측면에서 상당히 높은 비용이 발생합니다. RAW HTML/이미지 서빙은 역동적 인 것보다 훨씬 빠릅니다.

이렇게하려면 웹 응용 프로그램 루트를 마우스 오른쪽 버튼으로 클릭하고 "속성"을 선택하십시오. "홈 디렉토리"탭을 선택하십시오. "구성"을 클릭하십시오. 새 창이 나타납니다. ASP.NET 페이지 중 하나에서 경로를 복사 한 다음 와일드 카드 응용 프로그램 맵에 사용하십시오.

다시 명심하십시오 잘못된 답변 대부분의 시간. 그것은 당신의 성능에 부정적인 영향을 미치며, 칠기 톱을 사용하여 칠면조를 개척하는 것과 같습니다. 나는 당신을 위해 운동 할 경우이 옵션보다 첫 번째 옵션을 강력히 추천합니다.

다른 팁

For information:

This is one of the several nice things that IIS7 brings - all pages are routed through the handler such that you can do custom 404s and - usefully - directory and file level security for any file (based on the same web.config stuff as for asp.net files prior to IIS7).

So notionally "use II7" is an answer (will be "the" answer in time) - but of course its not a terribly practical one if you're not hosting/being hosted on W2k8 (or higher).

The web.config can only set up errors pages for pages controlled by it's web site. If you have any other pages outside the purview of the ASP.Net application, then you set up handling for them in IIS. There's an option in there for configuring the 404 page where you can point it to your custom page.

Only other thing i can think of is passing ALL extensions to asp.net.

This way all types of files get processed by asp.net and your custom error page will work.

In the IIS application configuration, you can set a wildcard mapping (".*") to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

  1. You can setup wild card mapping in IIS (Application configuration/Mappings/Wildcard mappings/ - just set aspnet_isapi.dll as executable and uncheck the Verify that file exists box) that will route all incoming requests to your app - so you can control the behavior directly from it.

  2. You don't have to setup static page in your IIS application settings. Imho, you should be able to setup valid url (e.g. /error_handler.aspx) from your app that will be used as landing page in case of specific server error.

In IIS you can set a Custom Error for 404 errors and direct it to a URL in the site properties.

It shows a static html by default C:\WINDOWS\help\iisHelp\common\404b.htm

You can change it to a relative url on your site.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top