Azure Logic Apps: 405 – Method Not Supported Errors from HttpListener

This one starts with a joke:

A gentleman walks up to a wall and starts banging his head against it.  Hard.  In fact, he bangs his head so hard, that people around grow concerned and one person says to him, “Sir, why do you keep banging your head against the wall?”  He replies, “Because it feels so good when I stop.”

So, like the gentleman in the above joke, I’ve been (figuratively) banging my head against the wall while trying to figure out how to invoke a Logic App I have deployed to the Azure cloud via an HttpListener.

I was using a PostAsync() call on the HttpClient to invoke the listener, but kept getting a 405 - Method Not Supported exception from the service. I was pretty sure POST should have been allowed! After checking the address, double-checking all the configurations, and so forth I couldn’t figure out why I would get the response I got (hence, the figurative banging of my head against a wall).

As is often the case, I found the answer in a post on an MSDN forum. When I copied the URL from the API definition of my HttpListener in Azure, it began with http instead of https, which was required.  A simple mistake and easy to miss.

After making the URL correction, adding an “s” to http, my calls to the service worked just fine.

And it feels really good now that I’ve stopped banging my head against the wall.

Advertisements

Tags:

About Ed Jones

Ed is a .NET and Integration architect for Avanade in the Twin Cities. Contact Ed

2 responses to “Azure Logic Apps: 405 – Method Not Supported Errors from HttpListener”

  1. Johann says :

    Hi Ed,

    I told the logic apps team (via the azure advisers yammer forum) about 4 months ago. If you try to connect to the endpoint using http it will redirect you to the HTTPS endpoint using a 303. 303’s will ignore the original http verb and send across a GET instead, so depending on whether your logic app is triggered by a GET or not this might or might not work. A preferable solution would be to either use something like a 307 redirect or disable the http endpoint altogether.

    Cheers
    Johann

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: