locked
Service Bus Connector: HTTP Error 400.0 - Bad Request RRS feed

  • Question

  • Hi,

    I've been trying to get a Service Bus Connector working in Logic Apps as both trigger and action but it just wont work.

    I'm getting a HTTP Error 400.0 - Bad Request.

    I'm using two different queues for the incoming and outgoing message and they both have access policies with manage, send and listen permissions.

    Im getting the following error on the ServiceBusConnector Api App through the streaming log:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <title>IIS Detailed Error - 400.0 - Bad Request</title> 
    <style type="text/css"> 
    
    </style> 
     
    </head> 
    <body> 
    <div id="content"> 
    <div class="content-container"> 
    <h3>HTTP Error 400.0 - Bad Request</h3> 
    <h4>Bad Request</h4> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Most likely causes:</h4> 
    <ul> 	<li></li> </ul> 
    </fieldset> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Things you can try:</h4> 
    <ul> 	<li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
    </fieldset> 
    </div> 
     
    <div class="content-container"> 
    <fieldset><h4>Detailed Error Information:</h4> 
    <div id="details-left"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;ManagedPipelineHandler</td></tr> 
    <tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr> 
    <tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;System.Web.Http.WebHost.HttpControllerHandler</td></tr> 
    <tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr> 
     
    </table> 
    </div> 
    <div id="details-right"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://AzureServiceBusConnectorbfc906c026d742d7baf561676dc3fbfc:80/api/servicebusconnector/message?triggerState=</td></tr> 
    <tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;D:\home\site\wwwroot\api\servicebusconnector\message</td></tr> 
    <tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
    <tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
     
    </table> 
    <div class="clear"></div> 
    </div> 
    </fieldset> 
    </div> 
     
    <div class="content-container"> 
    <fieldset><h4>More Information:</h4> 
    The request could not be understood by the server due to malformed syntax. 
    <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=400,0,0x00000000,9200">View more information &raquo;</a></p> 
    <p>Microsoft Knowledge Base Articles:</p> 
      
     
    </fieldset> 
    </div> 
    </div> 
    </body> 
    </html> 

    Which says almost nothing.

    Side note: I don't seem to have a api\servicebusconnector\message path in my D:\home\site\wwwroot.

    Then I have the following error in the Logic App:

    Tacking-Id:

    5706fea4-708f-4f20-a4a5-a01098c8b57e

    Code: Bad Request

    Input:

    {
        "host": {
            "gateway": "https://-----.azurewebsites.net/",
            "id": "/subscriptions/----/resourcegroups/----/providers/Microsoft.AppService/apiapps/-----servicebusconnector"
        },
        "operation": "TriggerGetMessage",
        "parameters": {
            "triggerState": ""
        },
        "apiVersion": "2015-01-14",
        "authentication": {
            "scheme": "Zumo",
            "type": "Raw"
        }
    }

    And output message:

    {
        "headers": {
            "pragma": "no-cache,no-cache",
            "x-Content-Type-Options": "nosniff",
            "x-ms-proxy-outgoing-newurl": "https://azureservicebusconnector----.azurewebsites.net/api/servicebusconnector/message?triggerState=",
            "cache-Control": "no-cache",
            "set-Cookie": "ARRAffinity=----;Path=/;Domain=-----.azurewebsites.net,ARRAffinity=----;Path=/;Domain=----.azurewebsites.net",
            "server": "Microsoft-IIS/8.0",
            "x-AspNet-Version": "4.0.30319",
            "x-Powered-By": "ASP.NET",
            "date": "Tue, 24 Nov 2015 14:47:51 GMT"
        },
        "body": {
            "status": 400,
            "source": "https://azureservicebusconnector----.azurewebsites.net/api/servicebusconnector/message?triggerState=",
            "message": "An error has occurred."
        }
    }

    What is going on and how do i solve it?

    Thanks a bunch!

    Tuesday, November 24, 2015 3:21 PM

Answers

  • Hi Tomas.

    I think I finally got mine working after punching my screen a few times :-)

    First I tested accessing my queues using the Service Bus Explorer with the connection string you see on the RHS of the screen when selecting the queue in the old portal. Then I noticed that nothing was listed even when selecting all options under the shared access policies. However, using the connection string form the Service Bus namespace itself (RootManageSharedAccessKey) I could see them all.

    So basically I removed all instances I created for the Service Bus connector, then instead creating a new one from the logic app itself I created it by going to New  > MarketPlace > Service Bus Connector.

    Once you click on that and select "Package settings" to add the connection string and queue name and fill with the your service bus RootManageSharedAccessKey it all seems normal but if you click again in "Package settings" I noticed that the information wasn't there anymore so I filled once again and clicked OK. Next time I opened the settings all the information were there and then I finally clicked on "create" button at the bottom of the page.

    After that, opened my logic app and inserted the connector which was already under my resource group, saved and triggered my app sending a http request and BOOM! for the first time in days I could see a green success status icon for my app. 

    Not sure why but now I remember that with some connectors settings (such as File connector) sometimes it won't remember the app settings :-(

    Hopefully MS will get this fixed soon.

    In case you need, I can e-mail some screenshots. Good luck!

    Cheers

    • Marked as answer by Tomas Sig Monday, December 7, 2015 12:15 PM
    Monday, December 7, 2015 2:25 AM

All replies

  • Hi,

    any assistance forthcoming on my issue? I feel it's probably something silly and stupid that I've done wrong.

    Thank you!

    Thursday, November 26, 2015 7:36 AM
  • Hi,

    When you set up the connection to the service bus queue inside your Service Bus Connector action, the connection string should be something like: Endpoint=sb://.....servicebus.windows.net/;SharedAccessKeyName=...;SharedAccessKey=...

    Maybe you used the 'Queue Url' instead of the connection string.


    Regards, Sjoukje. Blog | LinkedIn | Twitter


    Friday, November 27, 2015 10:19 AM
  • yes, I am using the connection string.

    I have two queues in the service bus - one for incoming messages and one for outgoing (as test) and I am using the connection string that belongs to the shared access policies of each. My policies have full access.

    I am currently just writing to to the incoming queue (alarms) using the tutorial program as you can see at the bottom of this post.

    Let me just show exactly what I do when I create these Service Bus Connectors using a single connector:

    https://www.dropbox.com/s/qt7w5n4wjtf732q/SBC_scrsht_creating.png?dl=0

    https://www.dropbox.com/s/p047hnl96b11gob/SBC_scrsht_logicapp.png?dl=0

    Errors:

    2015-11-30T10:37:10 sandboxproc.exe C:\DWASFiles\Sites\AzureServiceBusConnectore------\Temp\applicationhost.config
    2015-11-30T10:37:10 env XPROC_TYPENAME=Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionHelper, Microsoft.Web.Hosting, Version=7.1.0.0, Culture=neutral, PublicKeyToken=------
    2015-11-30T10:37:10 env XPROC_METHODNAME=Transform
    2015-11-30T10:37:10 Start 'AzureServiceBusConnector' site extension transform
    2015-11-30T10:37:10 Cannot find 'D:\home\SiteExtensions\AzureServiceBusConnector\applicationHost.xdt'
    2015-11-30T10:37:10 sandboxproc.exe complete successfully. Ellapsed = 175.00 ms
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <title>IIS Detailed Error - 400.0 - Bad Request</title> 
    <style type="text/css"> 
    <!-- 
    body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;} 
    code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;} 
    .config_source code{font-size:.8em;color:#000000;} 
    pre{margin:0;font-size:1.4em;word-wrap:break-word;} 
    ul,ol{margin:10px 0 10px 5px;} 
    ul.first,ol.first{margin-top:5px;} 
    fieldset{padding:0 15px 10px 15px;word-break:break-all;} 
    .summary-container fieldset{padding-bottom:5px;margin-top:4px;} 
    legend.no-expand-all{padding:2px 15px 4px 10px;margin:0 0 0 -12px;} 
    legend{color:#333333;;margin:4px 0 8px -12px;_margin-top:0px; 
    font-weight:bold;font-size:1em;} 
    a:link,a:visited{color:#007EFF;font-weight:bold;} 
    a:hover{text-decoration:none;} 
    h1{font-size:2.4em;margin:0;color:#FFF;} 
    h2{font-size:1.7em;margin:0;color:#CC0000;} 
    h3{font-size:1.4em;margin:10px 0 0 0;color:#CC0000;} 
    h4{font-size:1.2em;margin:10px 0 5px 0; 
    }#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS",Verdana,sans-serif; 
    color:#FFF;background-color:#5C87B2; 
    }#content{margin:0 0 0 2%;;} 
    .summary-container,.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;;} 
    .content-container p{margin:0 0 10px 0; 
    }#details-left{width:35%;float:left;margin-right:2%; 
    }#details-right{width:63%;float:left;overflow:hidden; 
    }#server_version{width:96%;_height:1px;min-height:1px;margin:0 0 5px 0;padding:11px 2% 8px 2%;color:#FFFFFF; 
    background-color:#5A7FA5;border-bottom:1px solid #C1CFDD;border-top:1px solid #4A6C8E;font-weight:normal; 
    font-size:1em;color:#FFF;text-align:right; 
    }#server_version p{margin:5px 0;} 
    table{margin:4px 0 4px 0;width:100%;border:none;} 
    td,th{vertical-align:top;padding:3px 0;text-align:left;font-weight:normal;border:none;} 
    th{width:30%;text-align:right;padding-right:2%;font-weight:bold;} 
    thead th{background-color:#ebebeb;width:25%; 
    }#details-right th{width:20%;} 
    table tr.alt td,table tr.alt th{} 
    .highlight-code{color:#CC0000;font-weight:bold;font-style:italic;} 
    .clear{clear:both;} 
    .preferred{padding:0 5px 2px 5px;font-weight:normal;background:#006633;color:#FFF;font-size:.8em;} 
    --> 
    </style> 
     
    </head> 
    <body> 
    <div id="content"> 
    <div class="content-container"> 
    <h3>HTTP Error 400.0 - Bad Request</h3> 
    <h4>Bad Request</h4> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Most likely causes:</h4> 
    <ul> 	<li></li> </ul> 
    </fieldset> 
    </div> 
    <div class="content-container"> 
    <fieldset><h4>Things you can try:</h4> 
    <ul> 	<li>Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click <a href="http://go.microsoft.com/fwlink/?LinkID=66439">here</a>. </li> </ul> 
    </fieldset> 
    </div> 
     
    <div class="content-container"> 
    <fieldset><h4>Detailed Error Information:</h4> 
    <div id="details-left"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Module</th><td>&nbsp;&nbsp;&nbsp;ManagedPipelineHandler</td></tr> 
    <tr><th>Notification</th><td>&nbsp;&nbsp;&nbsp;ExecuteRequestHandler</td></tr> 
    <tr class="alt"><th>Handler</th><td>&nbsp;&nbsp;&nbsp;System.Web.Http.WebHost.HttpControllerHandler</td></tr> 
    <tr><th>Error Code</th><td>&nbsp;&nbsp;&nbsp;0x00000000</td></tr> 
     
    </table> 
    </div> 
    <div id="details-right"> 
    <table border="0" cellpadding="0" cellspacing="0"> 
    <tr class="alt"><th>Requested URL</th><td>&nbsp;&nbsp;&nbsp;https://AzureServiceBusConnector------:80/api/servicebusconnector/message?triggerState=</td></tr> 
    <tr><th>Physical Path</th><td>&nbsp;&nbsp;&nbsp;D:\home\site\wwwroot\api\servicebusconnector\message</td></tr> 
    <tr class="alt"><th>Logon Method</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
    <tr><th>Logon User</th><td>&nbsp;&nbsp;&nbsp;Anonymous</td></tr> 
     
    </table> 
    <div class="clear"></div> 
    </div> 
    </fieldset> 
    </div> 
     
    <div class="content-container"> 
    <fieldset><h4>More Information:</h4> 
    The request could not be understood by the server due to malformed syntax. 
    <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=400,0,0x00000000,9200">View more information &raquo;</a></p> 
    <p>Microsoft Knowledge Base Articles:</p> 
      
     
    </fieldset> 
    </div> 
    </div> 
    </body> 
    </html> 
    2015-11-30 10:37:12 AZURESERVICEBUSCONNECTOR------ GET /api/servicebusconnector/message triggerState=&X-ARR-LOG-ID=00000000-0000-0000-0000-000000000000 443 - 40.113.94.157 EMA-Gateway - - azureservicebusconnector------.azurewebsites.net 400 0 0 584 1318 2328
    2015-11-30T10:38:07 sandboxproc.exe C:\DWASFiles\Sites\#1AzureServiceBusConnector------\Temp\applicationhost.config
    2015-11-30T10:38:07 env XPROC_TYPENAME=Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionHelper, Microsoft.Web.Hosting, Version=7.1.0.0, Culture=neutral, PublicKeyToken=------
    2015-11-30T10:38:07 env XPROC_METHODNAME=Transform
    2015-11-30T10:38:08 Start 'AzureServiceBusConnector' site extension transform
    2015-11-30T10:38:08 sandboxproc.exe C:\DWASFiles\Sites\AzureServiceBusConnector------\Temp\applicationhost.config
    2015-11-30T10:38:08 env XPROC_TYPENAME=Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionHelper, Microsoft.Web.Hosting, Version=7.1.0.0, Culture=neutral, PublicKeyToken=------
    2015-11-30T10:38:08 env XPROC_METHODNAME=Transform
    2015-11-30T10:38:08 Cannot find 'D:\home\SiteExtensions\AzureServiceBusConnector\applicationHost.xdt'
    2015-11-30T10:38:08 sandboxproc.exe complete successfully. Ellapsed = 225.00 ms
    2015-11-30T10:38:08 Start 'AzureServiceBusConnector' site extension transform
    2015-11-30T10:38:08 Cannot find 'D:\home\SiteExtensions\AzureServiceBusConnector\applicationHost.xdt'
    2015-11-30T10:38:08 sandboxproc.exe complete successfully. Ellapsed = 197.00 ms

    The only thing in D:\home\site\siteextensions\AzureServiceBusConnector is:

    > type SiteExtensionStatus.json
    D:\home\site\siteextensions\AzureServiceBusConnector
    {
      "provisioningState": "Succeeded",
      "operation": null,
      "status": "OK",
      "siteExtensionType": "WebRoot",
      "comment": null
    }

    static void sendMessage()
            {
                // Create the queue if it does not exist already.
                string connectionString =
                    CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.SendConnectionString");
    
                QueueClient Client = QueueClient.CreateFromConnectionString(connectionString, "highprioalarms");
    
                //Client.Send(new BrokeredMessage());
    
    
                // Create message, passing a string message for the body.
                BrokeredMessage message = new BrokeredMessage("Test message - " + DateTime.Now.ToString());
    
                // Set some addtional custom app-specific properties.
                message.Properties["TestProperty"] = "TestValue";
                message.Properties["Message number"] = 5;
    
                // Send message to the queue.
                Client.Send(message);
    
    
            }
    
            static void getMessage()
            {
                string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ReceiveConnectionString");
                QueueClient Client = QueueClient.CreateFromConnectionString(connectionString, "notifications");
    
                // Configure the callback options.
                OnMessageOptions options = new OnMessageOptions();
                options.AutoComplete = false;
                options.AutoRenewTimeout = TimeSpan.FromMinutes(1);
    
                // Callback to handle received messages.
                Client.OnMessage((message) =>
                {
                    try
                    {
                        // Process message from queue.
                        Console.WriteLine("Body: " + message.GetBody<string>());
                        Console.WriteLine("MessageID: " + message.MessageId);
                        Console.WriteLine("Test Property: " +
                        message.Properties["TestProperty"]);
    
                        // Remove message from queue.
                        //message.Complete();
                    }
                    catch (Exception)
                    {
                        // Indicates a problem, unlock message in queue.
                        message.Abandon();
                    }
                }, options);
            }


    Anything else I can provide you with? I can email you my subscription data etc

    Sincere regards and thanks!

    Monday, November 30, 2015 10:52 AM
  • Could you send your subscription data, please?

    Regards, Sjoukje. Blog | LinkedIn | Twitter


    Tuesday, December 1, 2015 12:12 PM
  • Sure, do you have an email I can use?
    Wednesday, December 2, 2015 7:34 AM
  • Sjoukje? Email?
    Thursday, December 3, 2015 7:29 AM
  • Hi Tomas.

    Have you had any luck with your problem? I'm having exact the same issue and I already tried deleting and re-creating the connector API but still get the same error either with topics or queues.

    I'm getting a bit frustrated with some connectors that keeps failing and all of the sudden decide to work :-)

    Cheers

    Friday, December 4, 2015 7:05 AM
  • Ok, now I'm annoyed - how is this not documented?

    I solved the problem and here is how:

    From here: connectedpawns.wordpress.com/2014/11/10/mabs-lessons-in-configuring-a-service-bus-queue-source/

    "The default authentication mechanism for Service Bus namespace has changed from ACS to SAS since I had last tried to use a Queue source and I wondered if this was the cause. I had created the service bus using powershell commands to make sure that the queue source could use ACS in its connection string. I had then created the queue quickly rather than custom. This was the flaw as I will explain.

    One of my colleagues Janardhan Chary mentioned he had struck the same issue and had only got around the issue when he did a custom create of the service bus queue and un-ticked the enable partition option."


    I mean, how is this not documented?! "Un-ticking the partition option"!

    Anyway. I will take the liberty of updating your documentation.

    Good weekend to ya.

    • Marked as answer by Tomas Sig Friday, December 4, 2015 2:55 PM
    • Unmarked as answer by Tomas Sig Monday, December 7, 2015 12:15 PM
    Friday, December 4, 2015 2:55 PM
  • Hey! Solved it for myself - see my message above!
    Friday, December 4, 2015 2:55 PM
  • Or not. Worked for one message - I then proceded to delete the working logic app with the service bus connector and recreate it - and then it stopped working.

    .....!

    Friday, December 4, 2015 4:58 PM
  • Hi Tomas.

    I think I finally got mine working after punching my screen a few times :-)

    First I tested accessing my queues using the Service Bus Explorer with the connection string you see on the RHS of the screen when selecting the queue in the old portal. Then I noticed that nothing was listed even when selecting all options under the shared access policies. However, using the connection string form the Service Bus namespace itself (RootManageSharedAccessKey) I could see them all.

    So basically I removed all instances I created for the Service Bus connector, then instead creating a new one from the logic app itself I created it by going to New  > MarketPlace > Service Bus Connector.

    Once you click on that and select "Package settings" to add the connection string and queue name and fill with the your service bus RootManageSharedAccessKey it all seems normal but if you click again in "Package settings" I noticed that the information wasn't there anymore so I filled once again and clicked OK. Next time I opened the settings all the information were there and then I finally clicked on "create" button at the bottom of the page.

    After that, opened my logic app and inserted the connector which was already under my resource group, saved and triggered my app sending a http request and BOOM! for the first time in days I could see a green success status icon for my app. 

    Not sure why but now I remember that with some connectors settings (such as File connector) sometimes it won't remember the app settings :-(

    Hopefully MS will get this fixed soon.

    In case you need, I can e-mail some screenshots. Good luck!

    Cheers

    • Marked as answer by Tomas Sig Monday, December 7, 2015 12:15 PM
    Monday, December 7, 2015 2:25 AM
  • You, good sir, are awesome. Thank you sincerely, Daniel!

    I tried a couple of different things and it appears that the only thing that was causing it, like you said, was that you had to click "Package settings" in the "Service Bus Connector" create a couple of times and refill the credentials if they had disappeared (which did not happen every time).

    Thank you again, this has been causing me so much frustration for so long. I hope MSFT gives you something for your solution.

    /Tomas 

    Monday, December 7, 2015 12:15 PM
  • Please see answer as provided by Daniel Schnabel de Barros.
    Monday, December 7, 2015 12:16 PM