您好,我在 mvc 应用程序中的链接有问题。当我通过 Visual Studio 运行它时,它没问题。然后链接如下: http://localhost:2566/ActivateClient/Activate/6543e2d6-707d-44ae-94eb-a75d27ea0d07
当我通过 IIS7 运行它时,链接如下: http://localhost/ActivationService/ActivateClient/Activate/6543e2d6-707d-44ae-94eb-a75d27ea0d07
默认路由如下:
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 = "" } // Parameter defaults
);
}
我假设我必须更改此 MapRoute,对吗?如何改变它?ActivationService 是我在 IIS 中的虚拟目录。有人可以帮我吗?我还尝试按如下方式进行映射:
routes.MapRoute(
"Default", // Route name
"ActivationService/{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
但也没有成功