2011-07-12 17 views
0

我有以下部分添加到我的web.config:爲什麼我會得到一個錯誤在我的web.config文件

<system.webServer> 
<caching> 
    <profiles> 
    <add extension=".html" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    <add extension=".htm" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    <add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="DontCache" location="Client" /> 
    </profiles> 
    </caching> 
</system.webServer> 

,將其吸收directly from here

但我在得到一個錯誤我web.config中,他說:

無法識別的配置節的System.Web /緩存/型材

也,我本身E本在Visual Studio:enter image description here

的元素緩存具有無效子元素「設定」,可以預期的列表:緩存,輸出緩存,outputcacheSettings,的SqlCacheDependency」

做了一件有關此配置的變化,我看到在這個確切的配置在網絡上的例子很多?

+0

在你提供的鏈接中,部分位於我想知道這是否有所作爲。 –

回答

3

在你的截圖中,你有緩存<system.web>下,而不是<system.webServer>而且由於型材是不是一個有效的元素<caching><system.web>下,你會得到錯誤。

1

你的代碼示例展示什麼是<system.webServer>下,是你在你的屏幕截圖顯示什麼<system.web>下,它需要在web服務器它來獲得配置文件選項,下的System.Web像你有它提供了所有那些你收到的錯誤提及的選項,根據你的調用方式而有所不同

相關問題