SignalR Requires Owin Startup Class, but my application works with Global.asax class.
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
if I add the startup class, my asp MVC project will have two start classes (global and startup), is it OK? or I should only apply one of them and move my global class to startup class?
You can mark which class in an assembly will be automatically used by Owin
in the startup.
In my example, I declared it in the Startup
and pointed to it using OwinStartup
eg
using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using System.Net;
[assembly: OwinStartup(typeof(YourProject.Startup))]
namespace YourProject
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
var hubConfiguration = new HubConfiguration
{
EnableDetailedErrors = true
};
app.MapSignalR(hubConfiguration);
}
}
}
If you are using Owin
, you must use the Startup
class instead of the Global.asax
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.