本文整理汇总了C#中RouteCollection.SetDefaultHttpConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.SetDefaultHttpConfiguration方法的具体用法?C# RouteCollection.SetDefaultHttpConfiguration怎么用?C# RouteCollection.SetDefaultHttpConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RouteCollection
的用法示例。
在下文中一共展示了RouteCollection.SetDefaultHttpConfiguration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
var config = new WebApiConfiguration { EnableTestClient = true };
config.ErrorHandlers = OnErrorHandlers;
if (UseHttpContextForStoringUniqueRequestId)
{
config.MessageHandlerFactory = () => new List<DelegatingHandler> { new HttpContextRequestIdHandler() };
}
else
{
config.MessageHandlerFactory = () => new List<DelegatingHandler> { new OperationContextRequestIdHandler() };
}
routes.SetDefaultHttpConfiguration(config);
routes.MapServiceRoute<StringService>("api/str");
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.IgnoreRoute("{resource}.axd/{*pathInfo}");
var config = new WebApiConfiguration() {EnableTestClient = true, EnableHelpPage = true};
routes.SetDefaultHttpConfiguration(config);
routes.MapServiceRoute<ExpeditionApi>("api/expvar");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
示例3: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// Custom configuration which enables the structuremap integaration
// via create/release instance methods.
var config = new ApiConfiguration() { EnableTestClient = true };
routes.SetDefaultHttpConfiguration(config);
routes.MapServiceRoute<ContactsApi>("api/contacts");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
示例4: RegisterRoutes
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
var config = new HttpConfiguration();
config.EnableTestClient = true;
config.MessageHandlers.Add(typeof(LoggingHandler));
config.ErrorHandlers = delegate { new ExceptionErrorHandler(); };
routes.SetDefaultHttpConfiguration(config);
routes.MapServiceRoute<ContactsApi>("api/contacts");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}