I have a windows service bus relay application running in console application. Initially I created using console app for testing. Now I have a requirement to convert this console application to windows service. All the Azure documentation only show examples with console application.
Is there is a way to create the service bus relay application using windows service, so that in my client side I don't need to run this console application(as a command prompt).
I am trying to connect cloud application to corporate/ secured network.
Created a new MVC web application to talk to relay service. Not sure what I am missing. Is there is any changes I need to do in "MyRelayTestService" config file.
using Microsoft.ServiceBus;
using System.ServiceModel;
using System.Web.Mvc;
using WCFRelay;
namespace TestRelayApplication.Controllers
{
public class HomeController : Controller
{
static ChannelFactory<IRelayTestChannel> channelFactory;
public ActionResult Index()
{
var tcpbinding = new NetTcpRelayBinding();
channelFactory = new ChannelFactory<IRelayTestChannel>(tcpbinding, "yourServiceNamespace");
channelFactory.Endpoint.Behaviors.Add(new TransportClientEndpointBehavior
{
TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider("RootManageSharedAccessKey", "yourKey")
});
using (IRelayTestChannel channel = channelFactory.CreateChannel())
{
var testStr = channel.DoWork(); // error on this call
}
return View();
}
}
}
Error: