2009-10-14 208 views
1

我知道你可以使用<remove />刪除密鑰。我試圖使用,但我的web.config中的一節,我想你不能刪除部分?如果我想刪除整個組「webServices」呢?從Web.Config刪除一個部分

<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> 
    <remove section="jsonSerialization" /> 
    <remove section="profileService" /> 
    <remove section="authenticationService" /> 
    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> 
    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> 
    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> 
</sectionGroup> 

IIS被投擲配合有關上述開始與此錯誤消息:

The requested page cannot be accessed because the related configuration data for the page is invalid.

它談論以上與jsonSerialization和該組中的隨後的部分開始的章節。

+0

你可以使用*什麼*刪​​除鍵? – 2009-10-14 19:12:01

+0

@亨克:我猜他不是指文本編輯器。 – 2009-10-14 19:14:26

+0

標籤將刪除web.config中的任何內容。 有效,但我想刪除上面的部分,它們不是模塊 – PositiveGuy 2009-10-14 19:15:22

回答

2

<section/>只定義了與該部分對應的類型。它不會添加節本身。那麼,爲什麼你想要刪除該部分?


順便說一句,<remove/>只適用於某些收藏。這些是那些有

<add/> 
<remove/> 
<clear/> 
+0

我收到來自父母的web.config繼承問題,需要刪除IIS正在投入的衝突部分。 – PositiveGuy 2009-10-14 19:19:17

+0

請用特定的縮小范例編輯您的問題。這是3.5還是2.0的問題? – 2009-10-14 19:26:39

+0

你遇到的衝突部分的實際錯誤是什麼?如果它與集合(部分外部)的集合有關,則在每個集合的頂部添加一個。 – 2009-10-14 19:27:09