问题
I want to remove the "Test... Invoke" section from the top of my web service pages (partly because the word 'test' may make users mistakenly think they are not executing something in production when they click it!), but still allow HTTPGET/POST for API users.
Any idea how?
回答1:
Try add follow text in Web.Config (I checked it - in my test-case it works)
<system.web>
<webServices>
<protocols>
<remove name="Documentation" />
</protocols>
</webServices>
</system.web>
http://msdn.microsoft.com/en-us/library/2tyf2t8t.aspx
回答2:
You are talking about *.asmx services, write?
Invoke available only when request is local, remote clients will see next message instead:
The test form is only available for requests from the local machine.
You can't modify this auto generated pages, but you might want to display custom page:
<system.web>
<webServices>
<wsdlHelpGenerator href="helpPage.aspx"></wsdlHelpGenerator>
</webServices>
</system.web>
In this case Wsdl still will be available at service.asmx?wsdl.
来源:https://stackoverflow.com/questions/17187978/asp-net-web-service-any-way-to-disable-the-test-invoke-section