2013-10-28 201 views
0

我試圖禁用WSDL和幫助頁面的Web服務的生成。我試着添加以下的web.config禁用Web服務的WSDL生成

<system.web.extensions> 
    <scripting> 
     <webServices> 
      <protocols> 
       <remove name="Documentation" /> 
      </protocols> 
     </webServices> 
    </scripting> 
</system.web.extensions> 

這將導致錯誤:The configuration section 'protocols' cannot be read because it is missing a section declaration

我加入了部分

<sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web"> 
    <section name="protocols" type="System.Web.Configuration.ProtocolsSection, System.Web" requirePermission="false" allowLocation="true" /> 
</sectionGroup> 

這將導致錯誤:There is a duplicate 'system.web/protocols' section defined

這第二個錯誤是有道理的,section是在Machine.config中定義的,但是鑑於它被定義了,爲什麼我會得到第一個錯誤,以及如何禁用wsdl和幫助文檔的生成?

回答

0

web服務是在錯誤的部分,應該是system.web

<system.web> 
    <webServices> 
     <protocols> 
      <remove name="Documentation" /> 
     </protocols> 
    </webServices> 
</system.web>