ilivewithian
ilivewithian

Reputation: 19692

Disabling WSDL Generation for a Web Service

I am trying to disable the generation of WSDL and help pages for a webservice. I've tried adding the following to the web.config:

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

This results in the error: The configuration section 'protocols' cannot be read because it is missing a section declaration

I then added the section

<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>

This results in the error: There is a duplicate 'system.web/protocols' section defined

This second error makes sense, the section is defined in Machine.config, but given that it is defined, why then do I get the first error and how can I disable the generation of the wsdl and help document?

Upvotes: 1

Views: 3707

Answers (1)

AndyRB
AndyRB

Reputation: 36

The webservices are in the wrong section, it should be system.web:

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

Upvotes: 2

Related Questions