asp.net - Error: SignalRRouteExtension.Mapconnection is obsolete. use MapSignalR in Owin Startup class -
i developing asp.net mvc application asp.net signalr. getting error , couldn't find how solve this. global.asax class , getting error @ here when started project:
public class mvcapplication : system.web.httpapplication { protected void application_start(object sender, eventargs e) { arearegistration.registerallareas(); webapiconfig.register(globalconfiguration.configuration); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); //this added , getting error. routetable.routes.mapconnection<nfcconnection>("echo", "/echo"); } }
and connection class @ bottom
public class nfcconnection : persistentconnection { protected override task onconnected(irequest request, string connectionid) { string msg = string.format( "a new user {0} has joined. (id: {1})", request.querystring["name"], connectionid); return connection.broadcast(msg); } protected override task onreceived(irequest request, string connectionid, string data) { string msg = string.format( "{0}: {1}", request.querystring["name"], data); return connection.broadcast(msg); } }
this part broadcast data coming client. , startup class owin that;
public class startup { public void configuration(iappbuilder app) { app.mapsignalr(); } }
when start project line
routetable.routes.mapconnection<nfcconnection>("echo", "/echo");
giving me error;
error'system.web.routing.signalrrouteextensions.mapconnection<t>(system.web.routing.routecollection, string, string)' obsolete: 'use iappbuilder.mapsignalr<tconnection> in owin startup class.
how can solve this?
remove:
routetable.routes.mapconnection<nfcconnection>("echo", "/echo");
and change:
app.mapsignalr();
to:
app.mapsignalr<nfcconnection>("/echo");
Comments
Post a Comment