ASP.NET MVC 4 自定义 URL
ASP.NET MVC 4 Custom URL
我是 MVC 的新手,我正在尝试将默认 url 从 http://localhost:55920/
更改为 http://myCustonURL/
我的路线配置:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional }
);
}
}
我该怎么做?
它只适用于您的计算机,
但你可以用这个
In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property Pages.
In the Property Pages dialog box, click the Start Options tab.
Under Server, click Use custom server.
In the Base URL box, type the URL that Visual Studio should start when running the current project.
来自Here also Here2
我是 MVC 的新手,我正在尝试将默认 url 从 http://localhost:55920/
更改为 http://myCustonURL/
我的路线配置:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional }
);
}
}
我该怎么做?
它只适用于您的计算机, 但你可以用这个
In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property Pages. In the Property Pages dialog box, click the Start Options tab. Under Server, click Use custom server. In the Base URL box, type the URL that Visual Studio should start when running the current project.
来自Here also Here2