I have a problem with my project.
I use ASP.NET MVC with ASP.NET Identity 2.0 for authentication and I added SignalR to the project so now I have two Startup.cs file
Could you put both sets of code into one single OwinStartup file?
namespace MCWeb_3SR
{
public class OwinStartup
{
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
var heartBeat = GlobalHost.DependencyResolver.Resolve<ITransportHeartbeat>();
var monitor = new PresenceMonitor(heartBeat);
monitor.StartMonitoring();
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
}
Move your signalr startup file to the App_Start folder and rename it to Startup.SignalR.cs. It should have this content, note that the Configure method has been renamed to ConfigureSignalR:
namespace MCWeb_3SR
{
public partial class Startup
{
public void ConfigureSignalR(IAppBuilder app) {
var heartBeat = GlobalHost.DependencyResolver.Resolve<ITransportHeartbeat>();
var monitor = new PresenceMonitor(heartBeat);
monitor.StartMonitoring();
// Any connection or hub wire up and configuration should go here
app.MapSignalR();
}
}
}
Now in the Startup.cs file at the root of your project, add a ConfigureSignalR(app) call right after ConfigureAuth(app):
[assembly: OwinStartup(typeof(MCWeb_3SR.Startup))]
namespace MCWeb_3SR
{
public partial class Startup
{
public void Configuration(IAppBuilder app) {
ConfigureAuth(app);
ConfigureSignalR(app);
}
}
}
As long as all of the Startup partial classes have the same namespace, this should work.