次のルートを指定しています-MyHttpMethodConstraintは、フォーム変数によってオーバーライドされたHTTPメソッドをチェックするルートです。
routes.MapRoute("Retrieve", "{controller}/{id}/{action}", new { action = "retrieve" }, new { action = "create|retrieve|update|delete", httpMethod = new MyHttpMethodConstraint("GET", "HEAD"), id = new GuidRouteConstraint() });
routes.MapRoute("Update", "{controller}/{id}", new { action = "update" }, new { action = "update", httpMethod = new MyHttpMethodConstraint("PUT"), id = new GuidRouteConstraint() });
routes.MapRoute("Delete", "{controller}/{id}", new { action = "destroy" }, new { action = "delete", httpMethod = new MyHttpMethodConstraint("DELETE"), id = new GuidRouteConstraint() });
routes.MapRoute("Create", "{controller}", new { action = "create" }, new { action = "create", httpMethod = new MyHttpMethodConstraint("POST") });
すべてがアクションに正しく着信するようにルーティングされますが、Url.ActionLinkのURL生成は(HTTP GETメソッドに制約されているルートを使用して)期待どおりに機能せず、代わりにPOST / PUT/DELETEに制約されているルートを見つけます。間違ったURL。ルートを並べ替えてみましたが、役に立ちません。URL生成は制約を無視することを期待しています。
独自のActionLinkメソッドを作成する以外に、回避策はありますか?
編集
リストの下部にはデフォルトルートもあります。
routes.MapRoute("Default", "{controller}/{action}", new { controller = "home", action = "index" });