Last post Jun 19, 2018 02:44 PM by anita12091987
Oct 29, 2012 09:59 AM|rishialagesan|LINK
Can ASP.NET Web API be used to communicate with Service Bus for exhanging messages or what are the possibilities of ASP.NET Web API and Service Bus together.
Thanks in advance.
Nov 26, 2012 06:41 PM|vvs1024|LINK
Yes, if you host webservice yourself.
Reference this blog and source code here:
Nov 27, 2012 02:35 AM|Amit Pachahara|LINK
Yes for sure, we can easliy use ASP.NET Web API to consume Service bus for that you need to create channel inside model under .cs file and consume the operation contracts on Controller side by simplying through that channel . Please find below code to create
channel using binging and endpoint .
Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("sb",
ChannelFactory<IMPNCustomerServiceChannel> channelFactory =new
IMPNCustomerServiceChannel channel = channelFactory.CreateChannel();
Please mark it as answer if it works for you .
Dec 13, 2012 04:17 AM|Ankit Puranik|LINK
ASP.NET Web API can indeed communicate with the Azure Service Bus. There can be number of possibilities in the question you asked:
1) The Web API is hosted "On Premise" and some Azure hosted cloud service wants to access this Web API using service bus.
2) The Web API is hosted on Azure and it wants to access some service which is hosted "On Premise" via Service Bus.
So which scenario you looking the solution for?
One thing is obvious, that you have to do establish a channel for the communication between the Service Bus and the Web API.
Let me know the scenario better so that I can provide you the exact solution.
Sep 19, 2014 06:29 AM|Saravanan2009|LINK
Thanks for your reponse, could you please share some piece of code. i am using asp.net odata web api and entity framework for model, i dont have any wcf contracts tec. this what i have done so far,
1. created new a webapi project (mvc selected)
2. Added new data model and chose my database and selected tables.
3. added the odata endpoint in WebApiConfig
4. created serviceBus in azure portal
then how do i call my web-api using servicebus url. as you mentioned need to add the createChanel method in contracts.but i dont have contracts.
what should do further to work ?
Jun 19, 2018 02:44 PM|anita12091987|LINK
Were you able to host service bus in web api. I need to do similar thing in my web api.