User-1045299099 posted
Hi guys
I'm struggeling to establish a connection from a uwp application over signalr to my asp.net core application running a signalR server
My Startup class on the SignalR server:
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddSignalR();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseSignalR(routes =>
{
routes.MapHub<MonitoringHub>("MonitoringHub");
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=DeviceMonitoring}/{action=Index}/{id?}");
});
}
}
SignalR Client project running on the same machine:
using Microsoft.AspNet.SignalR.Client;
using Microsoft.AspNet.SignalR.Client.Transports;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PiFace_II
{
class MonitoringHubHandler
{
private IHubProxy monitoringHubProxy;
// private HubConnection monitoringHubConnection;
private IDevice device;
public MonitoringHubHandler(IDevice device)
{
this.device = device;
establishHubConnection();
}
private async Task establishHubConnection()
{
var monitoringHubConnection = new HubConnection("http://localhost:59162/MonitoringHub");
monitoringHubProxy = monitoringHubConnection.CreateHubProxy("MonitoringHub");
monitoringHubProxy.On<PinState>("SetDeviceInput", PinState => SetDeviceInput(PinState));
monitoringHubConnection.StateChanged += MonitoringHubConnection_StateChanged;
await monitoringHubConnection.Start();
}
.
.
.
.
The connection state from the "monitoringHubConnection" changes from disconnected to connecting that's all... I don't recive any response error back etc.
Hope someone can help...
Thanks!