서문은HtmlHelper.AntiForgeryToken을 호출 할 때 왜 TypeInitializationException이 발생합니까?
나는 어디에서 여기에이 질문을 찾을 수 있는지 확인하기 위해 검색 한 나는 할 수 없습니다. I previously asked on meta에 버그가보고되면 유효합니다.
나는이 출처의 버그를보고해야하고 커뮤니티의 생각이 들었다면 아마도 다른 사람들이 건너 뛸 수 있도록 질문하고 질문 할 수있을 것이라고 생각했습니다. 그래서 여기에 내 커뮤니티 비트를하러 간다.
문제
나는 FormatterGenerator
에서 TypeInitializationException
을 던졌습니다 Html.AntiForgeryToken
를 호출하는 MVC를 볼 수 있습니다.
The virtual path '[path]' maps to another application, which is not allowed [ArgumentException: The virtual path '/Asp%20Net%20Bug%202008/Account/Register' maps to another application, which is not allowed.] System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +11193138 System.Web.HttpContext.GetFilePathData() +61 System.Web.Configuration.HttpCapabilitiesBase.GetBrowserCapabilities(HttpRequest request) +124 System.Web.HttpRequest.get_Browser() +168 System.Web.UI.Page.SetIntrinsics(HttpContext context, Boolean allowAsync) +207 System.Web.UI.Page.ProcessRequest(HttpContext context) +232 System.Web.Mvc.TokenPersister.CreateFormatterGenerator() +459 System.Web.Mvc.FormatterGenerator..cctor() +10 [TypeInitializationException: The type initializer for 'FormatterGenerator' threw an exception.] System.Web.Mvc.AntiForgeryDataSerializer.get_Formatter() +38 System.Web.Mvc.AntiForgeryDataSerializer.Serialize(AntiForgeryData token) +181 System.Web.Mvc.HtmlHelper.GetAntiForgeryTokenAndSetCookie(String salt, String domain, String path) +405 System.Web.Mvc.HtmlHelper.AntiForgeryToken(String salt, String domain, String path) +13 System.Web.Mvc.HtmlHelper.AntiForgeryToken() +17 ASP.views_account_register_aspx.__RenderregisterContent(HtmlTextWriter __w, Control parameterContainer) in c:\Users\andras.zoltan\documents\visual studio 2008\projects\aspnetbug2008\aspnetbug2008\Views\Account\Register.aspx:17 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115 ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Users\andras.zoltan\documents\visual studio 2008\projects\aspnetbug2008\aspnetbug2008\Views\Shared\Site.Master:26 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240 System.Web.UI.Page.Render(HtmlTextWriter writer) +38 System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +89 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4240
그들이 프로젝트를로드하고 실행할 때 동료가이 문제를하지 않는다는 것입니다 심지어 낯선 사람 (스크롤 막대에 대한 사과) 다음과 같은 스택 추적입니다.
내 환경은 VS2008 및 IIS7.5입니다. 이것은 MVC2 프로젝트입니다.