Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 13, 2012 08:17 AM by Ankit Puranik
Oct 29, 2012 01:59 PM|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 10:41 PM|LINK
Yes, if you host webservice yourself.
Reference this blog and source code here:
Nov 27, 2012 06:35 AM|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 08:17 AM|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.