Tuesday 19 April 2016

How to disable web services help WSDL of .asmx in Asp.net? [Solved]

We have a service page in my application, but we don't want to expose it to publicly, what should i do?
We want to stop these pages to browse on browser directly.
../webservice.asmx
../webservice.asmx?WSDL
../webservice.asmx??op=DoAction


Solution: To disable the service help page for an individual Web application, you can make change in your application web.config
file. like this

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



More on official MSDN page
https://msdn.microsoft.com/en-us/library/2tyf2t8t(v=vs.100).aspx