How To Invoking Webmethods from Remote Machine

We can test a ASP.NET Web service by browsing the .asmx file and trying to invoke the webmethods available, from the local machine. However, If we would like to invoke the service from other machine, by default, it would display the message "The test form is only available for requests from the local machine." To enable the Service to be invoked from remote machine, we need to add the following settings to the Web.Config file of the Web Service Application.

<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
This would enable the Web service to be able to be invoked from remote machine. This setting would only be useful in development / testing scenarios and it is advisable to remove / comment the above section when releasing for production, due to security reasons.

No comments:

Post a Comment