私は、ほぼ 2 か月間取り組んでいない ASP.NET MVC プロジェクトを持っています。コードを変更しない限り、ブラウザでのデバッグは正常に機能します。コードを変更した瞬間、空白を追加しても、次のエラーが発生します。
An exception of type 'System.NotSupportedException' occurred in EntityFramework.dll but was not handled in user code
Additional information: The type 'System.Web.Routing.RouteCollection+IgnoreRouteInternal' and the type 'System.Web.Mvc.RouteCollectionExtensions+IgnoreRouteInternal' both have the same simple name of 'IgnoreRouteInternal' and so cannot be used in the same model. All types in a given model must have unique simple names. Use 'NotMappedAttribute' or call Ignore in the Code First fluent API to explicitly exclude a property or type from the model.
例外は次の行で発生します。
var item = Cards.FirstOrDefault(s => s.name == cardName);
私が考えることができる唯一のことは、すべてが正常であると言うことができる限り、ルーティング設定の変更は、おそらくこのプロジェクトを再び取り上げる前に行った最後のことの1つであったということです. もう 1 つは、私は TortiseGit と bitbucket を使用していますが、それがどのような影響を与えるかわかりません。問題のない同様の設定の別のプロジェクトがあります。
間違えた場合のために、これは私の RouteConfig.cs です。
using System;
using System.Web.Mvc;
using System.Web.Routing;
namespace houseOfCards
{
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 }
);
routes.MapRoute(
name: "Hello",
url: "{controller}/{action}/{name}/{id}"
);
}
}
}
これを解決する方法がわかりません。何か提案をいただければ幸いです。