本文整理汇总了C#中RouteCollection.MapHubs方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapHubs方法的具体用法?C# RouteCollection.MapHubs怎么用?C# RouteCollection.MapHubs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.MapHubs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapHubs(new HubConfiguration
{
EnableCrossDomain = true
});
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"WeatherByMonth",
"weather/{station}/{year}/{month}",
new { controller = "Weather", action = "ByMonth" }
);
routes.MapRoute(
"WeatherByStation",
"weather/{station}",
new { controller = "Weather", action = "Index" }
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
示例2: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.LowercaseUrls = true;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// Map SignalR hubs
routes.MapHubs();
// Profile picture
routes.MapRoute(
name: "Profile picture",
url: "users/profile/{id}/picture",
defaults: new { controller = "Users", action = "ProfilePicture" }
);
routes.MapRoute(
name: "OAuth2 Callback",
url: "login/oauth2-callback",
defaults: new {controller = "Login", action = "OAuth2_Callback"}
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
示例3: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHubs();
routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
示例4: RegisterSignalR
public static void RegisterSignalR(RouteCollection routes)
{
Ensure.That(() => routes).IsNotNull();
// this special route is for SignalR hubs.
routes.MapHubs("~/realtime");
}
示例5: Register
public static void Register(RouteCollection routes)
{
const string connectionString = "Data Source=(local);Initial Catalog=SignalRBackend;Integrated Security=SSPI;Asynchronous Processing=True;";
//GlobalHost.DependencyResolver.UseSqlServer(connectionString);
var hubConfig = new HubConfiguration { EnableCrossDomain = true };
routes.MapHubs(hubConfig);
}
示例6: RegisterSignalR
public static void RegisterSignalR(RouteCollection routes)
{
if (routes == null)
{
throw new ArgumentNullException("routes");
}
// this special route is for SignalR hubs.
routes.MapHubs("~/realtime");
}
示例7: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapConnection<SendingConnection>("sending-connection", "sending-connection");
routes.MapConnection<TestConnection>("test-connection", "test-connection");
routes.MapConnection<RawConnection>("raw-connection", "raw-connection");
routes.MapConnection<StreamingConnection>("streaming-connection", "streaming-connection");
// Register the default hubs route /signalr
routes.MapHubs(new HubConfiguration() { EnableDetailedErrors = true });
}
示例8: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHubs();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}",
defaults: new { controller = "Test", action = "Index" }
);
}
示例9: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapHubs(new HubConfiguration() { EnableCrossDomain = true });
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
示例10: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapConnection<SendingConnection>("sending-connection", "sending-connection/{*operation}");
routes.MapConnection<TestConnection>("test-connection", "test-connection/{*operation}");
routes.MapConnection<RawConnection>("raw-connection", "raw-connection/{*operation}");
routes.MapConnection<StreamingConnection>("streaming-connection", "streaming-connection/{*operation}");
// Register the default hubs route: ~/signalr/hubs
routes.MapHubs();
}
示例11: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
//routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
var config = new HubConfiguration
{
EnableCrossDomain = true,
EnableDetailedErrors = true
};
routes.MapHubs(config);
routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
}
示例12: TestMapHubs
public void TestMapHubs()
{
RouteCollection routes = new RouteCollection();
bool delegateInvoked = false;
routes.MapHubs("signalr", new HubConfiguration(), appbuilder =>
{
appbuilder.Properties[ServerRequestFacts.OwinConstants.HostAppNameKey] = "test";
delegateInvoked = true;
});
Assert.True(delegateInvoked);
}
示例13: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes, ref RouteBase signalRHubRoute)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
signalRHubRoute = routes.MapHubs();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
示例14: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapHubs("~/signalr");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new {controller = "Ships", action = "Index", id = UrlParameter.Optional} // Parameter defaults
);
}
示例15: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
// Register the default hubs route: ~/signalr
routes.MapHubs();
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}