1
Im 새로운 AspNetCore MVC 6 설치를 테스트하고 catch-all 경로에 몇 가지 문제가 있습니다. 서버는 "http://localhost:5000/"과 catch-all 경로를 사용하도록 설정됩니다. "http://localhost:5000/asdasd"은 정상적으로 작동하지만 "http://localhost:5000/asdasd/"은 오류와 함께 실패합니다. 내 routing.ts에서MVC 6 Catch-ui.router를 사용하는 모든 경로
app.UseMvc(routes =>
{
routes.MapRoute(
name: "catchall",
template: "{*url}",
defaults: new { controller = "Home", action = "Index" });
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
이 : 내 시작이 사용
<script> document.write('<base href="' + document.location + '" />'); </script>
:
_layout.cshtml의 기본 href를 설정module app {
export class RoutingConfig {
static $inject = ["$locationProvider", "$stateProvider", "$urlRouterProvider"];
private ViewLocation: string = "assets/views/";
constructor(private $locationProvider: ng.ILocationProvider,
private $stateProvider: ng.ui.IStateProvider,
private $urlRouterProvider: ng.ui.IUrlRouterProvider
) {
$urlRouterProvider.otherwise("/");
$locationProvider.html5Mode(true);
$stateProvider.state("home", <ng.ui.IState>{
cache: false,
url: "/",
templateUrl: this.ViewLocation + "home/home.html",
controller: HomeController.ControllerId,
controllerAs: "vm"
});
}
}
angular.module("app").config(RoutingConfig);
}
, 포괄 경로는 그 모든 다른 경로를 실행 한 후 실행하려는 마지막 하나의로 마지막에 등록해야 을 통하여. –