我在global.asax上注册了以下路线;
routes.MapRoute(
"ServiceHandler",
"{*path}/{*.svc}",
new { Url = "Services/Service.svc/GetLatestTweets" }
);
http://www.domainname.com/Services/Service.svc/GetLatestTweets
当我使用上面提到的注册路由时,下面添加的stackstrace出现错误。
[ArgumentException: A catch-all parameter can only appear as the last segment of the route URL.
Parameter name: routeUrl]
System.Web.Routing.RouteParser.Parse(String routeUrl) +3823656
System.Web.Routing.Route..ctor(String url, IRouteHandler routeHandler) +24
System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults, Object constraints, String[] namespaces) +86
System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults, Object constraints) +28
System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults) +18
CMS.Presentation.FrontEnd.Framework.CMSApplication.RegisterRoutes(RouteCollection routes) in C:\Projects\Website\Web.Presentation\FrontEnd\Framework\CMSApplication.cs:62
CMS.Presentation.FrontEnd.Framework.CMSApplication.Application_Start() in C:\Projects\Website\Web.Presentation\FrontEnd\Framework\CMSApplication.cs:80
[HttpException (0x80004005): A catch-all parameter can only appear as the last segment of the route URL.
Parameter name: routeUrl]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3988565
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
[HttpException (0x80004005): A catch-all parameter can only appear as the last segment of the route URL.
Parameter name: routeUrl]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11529072
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4784373