当前位置: 首页>>代码示例>>C#>>正文


C# RouteCollection.MapServiceRoute方法代码示例

本文整理汇总了C#中RouteCollection.MapServiceRoute方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.MapServiceRoute方法的具体用法?C# RouteCollection.MapServiceRoute怎么用?C# RouteCollection.MapServiceRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.MapServiceRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapServiceRoute<HypermediaAPI.RootController>("");
            routes.MapServiceRoute<HypermediaAPI.Login.LoginController>("Login");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
开发者ID:ChrisMissal,项目名称:WcfWebApiContrib,代码行数:13,代码来源:Global.asax.cs

示例2: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapServiceRoute<GameService>("game");
            routes.MapServiceRoute<AuthService>("auth");
            routes.MapServiceRoute<UserService>("user");
            routes.MapServiceRoute<EventService>("event");

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional });
        }
开发者ID:BigMorty,项目名称:wa-toolkit-games,代码行数:14,代码来源:Global.asax.cs

示例3: 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
            );
        }
开发者ID:tparvi,项目名称:wcfwebapilog4net,代码行数:27,代码来源:Global.asax.cs

示例4: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            ContainerBuilder builder = new ContainerBuilder();
            Action<MappingConfiguration> mappingsConfig = mappings=>mappings.FluentMappings.AddFromAssemblyOf<NosSessionMap>();
            builder.Register<INHibernateSessionProvider, SqlServerConnectionStringNHibernateSessionProvider>().WithArguments(
                "nosplanner", mappingsConfig).ControlledBy<SingletonLifecycle>();
            builder.Register<INosSessionRepository, NosSessionRepository>().ControlledBy<SingletonLifecycle>();
            builder.Register<IAttendeeRepository, AttendeeRepository>().ControlledBy<SingletonLifecycle>();
            IContainer container = builder.Build();
            var configuration =
                HttpHostConfiguration
                    .Create()
                        .SetResourceFactory((serviceType, instanceContext, request) => container.Resolve(serviceType), null)
                        .SetErrorHandler<ContactManagerErrorHandler>();

            routes.MapServiceRoute<SessionsResource>("sessions", configuration);
            routes.MapServiceRoute<SessionResource>("session", configuration);
            routes.MapServiceRoute<AttendeesResource>("attendees",configuration);
        }
开发者ID:AlexZeitler,项目名称:OpenSpacePlanner,代码行数:19,代码来源:Global.asax.cs

示例5: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapServiceRoute<BlogEngineService>("blog");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

        }
开发者ID:sandrapatfer,项目名称:PROMPT11-06-Services.sandrapatfer,代码行数:13,代码来源:Global.asax.cs

示例6: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
                new { controller = "^(?!SignupSvc).*" }
            );

            var bldr = HttpHostConfiguration.Create().SetOperationHandlerFactory(new JsonOnlyFactory());
            routes.MapServiceRoute<SignupSvc>("SignupSvc", bldr);
        }
开发者ID:axshon,项目名称:HTML-5-Ellipse-Tours,代码行数:14,代码来源:Global.asax.cs

示例7: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

              // configure api service
              var config = new HttpConfiguration() { EnableTestClient = true };
              routes.MapServiceRoute<ContactsApi>("api/contacts", config);

              // configure mvc controllers
              routes.MapRoute(
              "Default", // Route name
              "{controller}/{action}/{id}", // URL with parameters
              new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults

              );
        }
开发者ID:danieleli,项目名称:Social-Manager-for-Good,代码行数:16,代码来源:Global.asax.cs

示例8: 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
            );
        }
开发者ID:gkinsman,项目名称:SteamBoat,代码行数:16,代码来源:Global.asax.cs

示例9: 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
            );
        }
开发者ID:tparvi,项目名称:wcfwebapiwithstructuremap,代码行数:17,代码来源:Global.asax.cs

示例10: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
                new { controller = ServiceContracts.In(Assembly.GetExecutingAssembly()).WithDefaultConverter() }
                );

            var configurationBuilder = HttpHostConfiguration.Create()
                .SetMessageHandlerFactory(new CustomHttpMessageChannelFactory())
                .SetOperationHandlerFactory(new CustomHttpOperationHandlerFactory());

            routes.MapServiceRoute<DateTimeService>(configurationBuilder);
        }
开发者ID:ChrisMissal,项目名称:WcfWebApiContrib,代码行数:17,代码来源:Global.asax.cs

示例11: 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
            );
        }
开发者ID:tparvi,项目名称:wcfwebapibom,代码行数:18,代码来源:Global.asax.cs

示例12: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            HttpConfiguration configuration = new WebApiConfiguration();// {EnableTestClient = true};
            configuration.Formatters.Add(new JpgFormatter());
            configuration.Formatters.Add(new RssFormatter());
            configuration.MessageHandlers.Add(typeof(UriFormatHandler));
            #if DEBUG
            configuration.EnableTestClient = true;
            #endif
            routes.MapServiceRoute<DonaldApi>("api/donald", configuration);
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }
开发者ID:mastoj,项目名称:DonaldWCFwebApi,代码行数:18,代码来源:Global.asax.cs

示例13: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapServiceRoute<AtomFeedService>("Feed", new AtomFeedHttpConfiguration());

            routes.MapRoute(
                "Index", // Route name
                "blogs", // URL with parameters
                new { controller = "Blogs", action = "Index"} // Parameter defaults
            );

            routes.MapRoute(
                "Create", // Route name
                "blogs/create", // URL with parameters
                new { controller = "Blogs", action = "Create"} // Parameter defaults
            );

            routes.MapRoute(
                "Edit", // Route name
                "blogs/{id}/edit", // URL with parameters
                new { controller = "Blogs", action = "Edit"} // Parameter defaults
            );

            routes.MapRoute(
                "Delete", // Route name
                "blogs/{id}/delete", // URL with parameters
                new { controller = "Blogs", action = "Delete"} // Parameter defaults
            );

            routes.MapRoute(
                "Details", // Route name
                "blogs/{id}", // URL with parameters
                new { controller = "Blogs", action = "Details"} // Parameter defaults
            );

            routes.MapRoute(
                "Posts", // Route name
                "blogs/{blogId}/posts", // URL with parameters
                new { controller = "Posts", action = "Index" } // Parameter defaults
            );

            routes.MapRoute(
                "CreatePost", // Route name
                "blogs/{blogId}/posts/create", // URL with parameters
                new { controller = "Posts", action = "Create" } // Parameter defaults
            );

            routes.MapRoute(
                "PostEdit", // Route name
                "blogs/{blogId}/posts/{id}/edit", // URL with parameters
                new { controller = "Posts", action = "Edit" } // Parameter defaults
            );

            routes.MapRoute(
                "PostDelete", // Route name
                "blogs/{blogId}/posts/{id}/delete", // URL with parameters
                new { controller = "Posts", action = "Delete" } // Parameter defaults
            );

            
            routes.MapRoute(
                "PostDetails", // Route name
                "blogs/{blogId}/posts/{id}", // URL with parameters
                new { controller = "Posts", action = "Details" } // Parameter defaults
            );


            routes.MapRoute(
                "Default", // Route name
                "", // URL with parameters
                new { controller = "Home", action = "Index"} // Parameter defaults
            );

            routes.MapRoute(
                "All", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional  } // Parameter defaults
            );
        }
开发者ID:vilhena,项目名称:PROMPT11-06-Services.vilhena,代码行数:80,代码来源:Global.asax.cs

示例14: RegisterServiceRoutes

        // note: Pulled out service route registration separately because it's not testable T.T (won't run outside IIS/WAS) 
        public static void RegisterServiceRoutes(RouteCollection routes)
        {
            routes.MapServiceRoute(
                RouteName.V1ApiFeed,
                "api/v1/FeedService.svc",
                typeof(V1Feed));

            routes.MapServiceRoute(
                "LegacyFeedService",
                "v1/FeedService.svc",
                typeof(V1Feed));

            routes.MapServiceRoute(
                "v1" + RouteName.V1ApiFeed,
                "api/v1",
                typeof(V1Feed));

            routes.MapServiceRoute(
                RouteName.V2ApiCuratedFeed,
                "api/v2/curated-feed",
                typeof(V2CuratedFeed));

            routes.MapServiceRoute(
                RouteName.V2ApiFeed,
                "api/v2/",
                typeof(V2Feed));
        }
开发者ID:whyleee,项目名称:RemoteFeedNuGetGallery,代码行数:28,代码来源:Routes.cs

示例15: RegisterRoutes


//.........这里部分代码省略.........
            routes.MapRoute(
                RouteName.PasswordReset,
                "account/{action}/{username}/{token}",
                MVC.Users.ResetPassword());

            routes.MapRoute(
                RouteName.Account,
                "account/{action}",
                MVC.Users.Account());

            routes.MapRoute(
                RouteName.CuratedFeed,
                "curated-feeds/{name}",
                new { controller = CuratedFeedsController.ControllerName, action = "CuratedFeed" });

            routes.MapRoute(
                RouteName.CreateCuratedPackageForm,
                "forms/add-package-to-curated-feed",
                new { controller = CuratedPackagesController.ControllerName, action = "CreateCuratedPackageForm" });

            routes.MapRoute(
                RouteName.CuratedPackage,
                "curated-feeds/{curatedFeedName}/curated-packages/{curatedPackageId}",
                new { controller = CuratedPackagesController.ControllerName, action = "CuratedPackage" });

            routes.MapRoute(
                RouteName.CuratedPackages,
                "curated-feeds/{curatedFeedName}/curated-packages",
                new { controller = CuratedPackagesController.ControllerName, action = "CuratedPackages" });

            // TODO : Most of the routes are essentially of the format api/v{x}/*. We should refactor the code to vary them by the version.
            // V1 Routes
            // If the push url is /api/v1 then NuGet.Core would ping the path to resolve redirection. 
            routes.MapServiceRoute(
                RouteName.V1ApiFeed,
                "api/v1/FeedService.svc",
                typeof(V1Feed));

            routes.MapServiceRoute(
                "LegacyFeedService",
                "v1/FeedService.svc",
                typeof(V1Feed));

            routes.MapRoute(
                "v1" + RouteName.VerifyPackageKey,
                "api/v1/verifykey/{id}/{version}",
                MVC.Api.VerifyPackageKey(),
                defaults: new { id = UrlParameter.Optional, version = UrlParameter.Optional });
            
            var downloadRoute = routes.MapRoute(
                "v1" + RouteName.DownloadPackage,
                "api/v1/package/{id}/{version}",
                MVC.Api.GetPackage(),
                defaults: new { version = UrlParameter.Optional },
                constraints: new { httpMethod = new HttpMethodConstraint("GET") });

            routes.MapRoute(
                "site" + RouteName.DownloadPackage,
                "packages/{id}/{version}/DownloadPackage",
                MVC.Api.GetPackage(),
                defaults: new { version = UrlParameter.Optional },
                constraints: new { httpMethod = new HttpMethodConstraint("GET") });

            routes.MapRoute(
                "v1" + RouteName.PushPackageApi,
                "v1/PackageFiles/{apiKey}/nupkg",
开发者ID:TomOne,项目名称:chocolatey.org,代码行数:67,代码来源:Routes.cs


注:本文中的RouteCollection.MapServiceRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。