Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net - web services - Stop WSDL and default help page being accessible but leave service up

I have a simple .Net web service. When I visit the /webservice.svc path in a browser .Net renders a nice help page with some sample C# and VB.Net code. How do I stop this from displaying? Also, is there any way to prevent a request for ?wsdl from returning the wsdl file?

Thanks for any insight in advance.

like image 342
frimley Avatar asked Dec 13 '22 20:12

frimley


1 Answers

Remove <serviceMetadata httpGetEnabled="true"/> from web.config

<system.serviceModel>
            ...
    <behaviors>
        <serviceBehaviors>
            <behavior name="mexBehavior">
                <!-- Remove this 
                    <serviceMetadata httpGetEnabled="true"/> 
                 -->
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>
like image 113
Per-Frode Pedersen Avatar answered May 14 '23 04:05

Per-Frode Pedersen