2012-06-11 4 views
0

우리 팀은 Silverlight 모듈을 사용하여 C# 프로젝트를 작성하고 있습니다. 우리는 IIS 7을 사용하는 Windows 2008에 배포합니다. ClientRoll이라는 폴더와 연결된 HTTP 응답 헤더를 즉시 만료하려고합니다. IIS 관리자를 통해 수동으로 수행하는 방법을 알고 있습니다. (기본적으로 관심있는 폴더 나 파일의 HTTP 응답 헤더 섹션으로 이동 한 다음 "Set Common Headers ..."를 사용하여 즉시 만료됩니다.) 그러나 IIS에 여러 번 다시 배포 할 예정입니다. 모든 시간을 재구성하고 유지하는 것이 골칫 덩이기 때문에 프로그래밍 방식으로 수행되도록하고 싶습니다.HTTP 응답 헤더를 프로그래밍 방식으로 만료하려고 시도

내 프로젝트의 C# 코드에서 수행해야합니까, 아니면 WMI 스크립팅을 사용하여 수행하는 것이 더 좋습니까?

답변

0

@kev와 제프-cuscutis @는

How to configure static content cache per folder and extension in IIS7?

OU가 설정할 수있는 ASP.NET 응용 프로그램의 web.config 파일에 XML 구성을 사용하여 HTTP 응답 헤더의 만료를 구성 할 수있는 방법을 제공 한 루트의 Web.config 중 하나에서 전체 폴더에 대한 특정 캐시 헤더 :

<?xml version="1.0" encoding="UTF-8"?> 

<configuration> 

<!-- Note the use of the 'location' tag to specify which 

    folder this applies to--> 

<location path="images"> 

<system.webServer> 

    <staticContent> 

    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" /> 

    </staticContent> 

</system.webServer> 

</location> 

</configuration> 

또는 콘텐츠 폴더에 web.config 파일에서 다음을 지정할 수 있습니다

<?xml version="1.0" encoding="UTF-8"?> 

<configuration> 

<system.webServer> 

<staticContent> 

    <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="00:00:15" /> 

</staticContent> 

</system.webServer> 

</configuration> 

특정 파일 형식을 대상으로하는 메커니즘이 내장되어 있습니다.

파일 단위로 할 수 있습니다. 경로 속성을 사용하여 파일 이름 포함

<?xml version="1.0" encoding="UTF-8"?> 

<configuration> 

<location path="YourFileNameHere.xml"> 

    <system.webServer> 

     <staticContent> 

      <clientCache cacheControlMode="DisableCache" /> 

     </staticContent> 

    </system.webServer> 

</location> 

</configuration> 
관련 문제