ローカルで実行すると、ウェブサイトはうまく動作します。しかし、Microsoft Azureに展開すると、次のエラーが発生します。'HelpPage_Default'という名前のルートがすでにルートコレクションにあります。ルート名は一意である必要があります。パラメータ名:名前
I既にbinフォルダとobjフォルダから.DLLファイルを削除しようとしましたが、問題はまだ存在します。
スタックトレース:
[ArgumentException: A route named 'HelpPage_Default' is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.Routing.RouteCollection.Add(String name, RouteBase item) +3213863
System.Web.Mvc.RouteCollectionExtensions.MapRoute(RouteCollection routes, String name, String url, Object defaults, Object constraints, String[] namespaces) +203
System.Web.Mvc.AreaRegistrationContext.MapRoute(String name, String url, Object defaults, Object constraints, String[] namespaces) +56
Makewayy.Areas.HelpPage.HelpPageAreaRegistration.RegisterArea(AreaRegistrationContext context) +87
System.Web.Mvc.AreaRegistration.CreateContextAndRegister(RouteCollection routes, Object state) +104
System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state) +190
System.Web.Mvc.AreaRegistration.RegisterAllAreas(Object state) +34
Makewayy.WebApiApplication.Application_Start() +12
[HttpException (0x80004005): A route named 'HelpPage_Default' is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +10104513
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): A route named 'HelpPage_Default' is already in the route collection. Route names must be unique.
Parameter name: name]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10085804
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
ルートの設定: -
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 = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
AreaRegistration -
namespace Makewayy.Areas.HelpPage
{
public class HelpPageAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "HelpPage";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"HelpPage_Default",
"Help/{action}/{apiId}",
new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
HelpPageConfig.Register(GlobalConfiguration.Configuration);
}
}
}
表示すると、ルート設定コードをご覧ください。 –
@ChetanRanpariyaが追加されました。 –
'AreaRegistration'はどうですか?そこにチェックしましたか? –