Viewed   82 times

I'm building a REST API on Azure, but when I try to access an endpoint via the PUT method I get a HTTP 405 "Method Not Allowed" status along with an IIS error message:

The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

How do I enable the PUT method, and other methods that may be blocked by default by Azure's default config settings?

I tried adding a web.config file to the root of my application with allowUnlisted set to true on the verbs element:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <system.webServer>
      <security>
         <requestFiltering>
            <verbs applyToWebDAV="false" allowUnlisted="true" />
         </requestFiltering>
      </security>
   </system.webServer>
</configuration>

This changed nothing.

I'm an open source guy, so the world of IIS is very unfamiliar to me. Any help is appreciated.

Thanks!

 Answers

1

Add the following to the web.config in the system.webServer element:

<handlers>
  <remove name="PHP54_via_FastCGI" />
  <add name="PHP54_via_FastCGI" path="*.php" verb="GET, PUT, POST, HEAD, OPTIONS, TRACE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK" modules="FastCgiModule" scriptProcessor="D:Program Files (x86)PHPv5.4php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>

This works for the built in versions of PHP, the current default is PHP 5.4, but if you have selected PHP 5.3 or PHP 5.5 you will need to modify the path of the php-cgi handler.

Wednesday, August 31, 2022
1

It turns out that I just had to go to wordpress settings and change my site address from mydomain.azurewebsites.net to mydomain.com. Here's a screenshot: http://prntscr.com/2kjwzp

Friday, September 30, 2022
 
peteter
 
1

Thanks a lot Puneet Gupta for pointing me in the right direction! I couldn't use the exact solution, but it set me on the right path.

Here's how I solved this:

1) Get your hands on the applicationHost.config. The easiest way is going through the SCM Console via "files" and then follow the links in json. In the end, you end up here: https://YOUR_WEBSITE_NAME.scm.azurewebsites.net/api/vfs/LocalSiteRoot/Config/applicationhost.config

2) Identify the current status of overlapped recycle. In the applicationHost.config file, look for the "applicationPools" element It should look like this:

<applicationPools>
  <add name="YOUR_SITE_NAME" managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" />
  </add>
  <add name="~1YOUR_SITE_NAME" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
    <processModel identityType="ApplicationPoolIdentity" />
  </add>
</applicationPools>

If you see this, then overlapped recycle is ENABLED! You can't write directly to this file but fortunately microsoft gives us the power to transform it!

3) Transform it! You can transform the applicationHost.config file by placing an applicationHost.xdt file in the /site directory of your website (mind you that the website itself is deployed in the /site/wwwroot directory, so your applicationHost.xdt transform must reside in the parent folder of where your website is. If you want to disable overlapped recycle, then this is what you put in the file:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">>
  <system.applicationHost>
    <applicationPools>
      <add name="YOUR_SITE_NAME" xdt:Locator="Match(name)">
        <recycling disallowOverlappingRotation="true" xdt:Transform="Insert" />
      </add>
      <add name="~1YOUR_SITE_NAMEd" xdt:Locator="Match(name)">
        <recycling disallowOverlappingRotation="true" xdt:Transform="Insert" />
      </add>
    </applicationPools>
  </system.applicationHost>
</configuration>

4) restart the site finally you need to restart your site to have your transformations applied. After restart, go to step 1 again and you should now see this instead:

<applicationPools>
  <add name="YOUR_SITE_NAME" managedRuntimeVersion="v4.0">
    <processModel identityType="ApplicationPoolIdentity" />
    <recycling disallowOverlappingRotation="true" />
  </add>
  <add name="~1YOUR_SITE_NAME" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
    <processModel identityType="ApplicationPoolIdentity" />
    <recycling disallowOverlappingRotation="true" />
  </add>
</applicationPools>

et voila: overlapped recycle is now disabled on your azure website.

Wednesday, December 21, 2022
 
2

If the library simply needs to be on the path for your application to pick it up, then just add it as an item in the project you're deploying, and it will get uploaded up to Azure, and deployed alongside your application.

If some commands are required to install it, you can use startup tasks.

As for the video stream, you can open a socket (using a TCP endpoint) and stream the video up to an azure instance that way. That's probably the most efficient way of doing it if you want real time video processing. If you want to record the video and upload it, look at using blob storage. You can then use a message queue to signal to the worker, that there is a video waiting to be processed.

Monday, September 12, 2022
 
5

Monitoring of SQL Azure is more limited than SQL Server, but the tools are becoming more available for you to look underneath:

http://social.technet.microsoft.com/wiki/contents/articles/troubleshoot-and-optimize-queries-with-sql-azure.aspx

Thursday, October 20, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :