问题描述
我很奇怪,为什么路线似乎是同时从HttpConfiguration对象和RouteTable类的配置?显然两.Routes性质不同类型的,但它们似乎保持同步。是否有机会,他们能拿出来不同步?我想知道,虽然,从Web API的角度来看,应该RouteTable.Routes 曾经的使用吗?
I am wondering why routes seem to be configurable from both the HttpConfiguration object and the RouteTable class? Clearly the two .Routes properties are not of the same type, but they seem to stay in-sync. Is there a chance they could get out-of-sync? I'm wondering though, from a Web API perspective, should RouteTable.Routes ever be used?
推荐答案
的 HttpConfiguration
类是特定的WebAPI使得它可重复使用外的IIS(例如对于自托管)。在 RouteTable
版本的IIS只。
The HttpConfiguration
class is specific to WebApi making it reusable outside of IIS (e.g. For self hosting). The RouteTable
version is for IIS only.
这篇关于RouteTable.Routes和HttpConfiguration.Routes之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!