当在本地运行应用程序时,所有路由都正常工作。但是在发布到Azure时,只有非区域控制器(如“Home”和“Account”)可以访问,区域路由会返回404错误。
Startup.cs文件中包含以下内容:
routes.MapRoute("areaRoute", "{area:exists}/{controller}/{action=Index}/{id?}");
project.json 包含依赖项(其中包括):
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
}
以及框架:
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
并发布选项:
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]