Zum Hauptinhalt springen

Prevent „Method not Allowed“ Error when using ASP.NET Web API

The error happens when the REST methods (POST, PUT, DELETE, etc). are already registered by another application. The following entries in the  web.config helped me to overcome the issue: <system.webServer> <validation validateIntegratedModeConfiguration=“false“ /> <modules runAllManagedModulesForAllRequests=“true“> <remove name=“WebDAVModule“ /> </modules> <handlers> <remove name=“WebDAV“ /> <remove name=“ExtensionlessUrlHandler-ISAPI-4.0_32bit“ /> <remove name=“ExtensionlessUrlHandler-ISAPI-4.0_64bit“ /> <remove name=“ExtensionlessUrlHandler-Integrated-4.0″ /> <add name=“ExtensionlessUrlHandler-ISAPI-4.0_32bit“ path=“*.“ […]

Check Availability of a Server

This checks the availability of a server by sending a ping to the given IP address and waiting a certain amount of time for a response from the server: public static bool ServerAvailable(string ip, int timeout) { Ping pingSender = new Ping(); PingReply reply; try { reply = pingSender.Send(ip, timeout); } catch { return false; […]