중요 메서드 'System.Web.WebPages.Razor.PreApplicationStartCode.Start ()'에 대한 'System.Web.Mvc.PreApplicationStartCode.Start ()'시도가 실패했습니다.
내 응용 프로그램이 제대로 작동하고 일부 업그레이드를 수행 한 후에이 오류가 발생합니다.
'/'응용 프로그램에 서버 오류가 있습니다.
보안 투명 방법 '
System.Web.Mvc.PreApplicationStartCode.Start()'에서 보안에 중요한 방법 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' 에 액세스 하려는 시도가 실패했습니다. 설명 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 발생했습니다. 오류 및 코드에서 오류가 발생한 위치에 대한 자세한 내용은 스택 추적을 검토하십시오.예외 정보 :
System.MethodAccessException: 보안 투명 방법 'System.Web.Mvc.PreApplicationStartCode.Start()'에서 보안에 중요한 방법 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' 에 액세스 하지 못했습니다.소스 오류 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 생성되었습니다. 아래의 예외 스택 추적을 사용하여 예외의 출처 및 위치에 대한 정보를 식별 할 수 있습니다.
버전 정보 : Microsoft .NET Framework 버전 : 4.0.30319; ASP.NET 버전 : 4.0.30319.18055
내가 한 업데이트를 기억할 수 없습니다. 이 문제를 해결할 방법이 있습니까?
문제가 해결되었다고 생각하지만 그렇지 않은 경우 Nuget의이 패키지를 사용하십시오.
Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
이 오류로 하루를 낭비했지만이 한 줄이 나를 위해 일했습니다.
시도했습니다. . .Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
과. . .Install-Package -Id Microsoft.AspNet.WebHelpers
둘 다 성공하지 못했고 마침내 nuget을 통해 모든 패키지를 업데이트해야했습니다. . 일했다 !!
http://www.3dbuzz.com/forum/threads/202082-ASP-net-MVC-Error-before-application-start
Visual Studio를 사용하는 경우 nuget 패키지 창을 열고 Update-Package를 실행하면 모든 dll이 최신 버전으로 업데이트됩니다. 그래도 작동하지 않으면 다음 페이지를 참조하십시오. http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project- to-aspnet-mvc-5- 및 -web-api-2
Mvc가 4에서 5로 업그레이드되었지만 web.config를 업데이트하지 않은 사이트를 배포 할 때이 오류가 발생했습니다.
이것에서 변경 :
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
이에:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
나를 위해 문제를 해결했습니다.
나에게도 같은 오류가 발생했습니다. NuGet 패키지를 설치하여 수정되었습니다.
Install-Package -Id Microsoft.AspNet.WebHelpers
비슷한 문제가 있었고 Anthony Fassett의 Asp.net MVC를 사용하여 Razor 2.0을 3.0으로 업데이트 하는 기사를 기반으로 해결했습니다.
내 Web.Config에서 다음 코드 블록이 누락되었습니다.
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
제 경우에는 비 호환성 문제였습니다. 나는 논문 pacakges가 있었다 :
Microsoft.AspNet.Mvc버전 4.xMicrosoft.AspNet.Razor및Microsoft.AspNet.WebPages, 버전 3.x
그 업그레이드 가정 Mvc5.x를에 일한 것입니다,하지만 난 유지하는 데 필요한 Mvc전 다운 그레이드했다, 그래서 4.x의를 Razor하고 Mvc2.x 또는 3.0에 이렇게하려면 다음과 같이 이전 버전을 설치하기 만하면됩니다.
Install-package Microsoft.AspNet.WebPages -version 2.0.30506
Install-Package Microsoft.AspNet.Razor -Version 2.0.30506
이러한 패키지를 다운 그레이드 한 후 첫 번째 오류가 사라졌지 만 .NET의 문제와 관련된 또 다른 오류가있었습니다 web.config. Razor의 바인딩 리디렉션을 변경해야했습니다.
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" ... />
<!--bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /-->
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
이유는 모르겠지만 바인딩 리디렉션은 Nuget 설치에 의해 업데이트되지 않았습니다.
이 문제에 대한 여러 솔루션이 있습니다.
- asp.net 솔루션 업그레이드에 대한 자습서를 따르십시오.
- Microsoft-Web-Helpers dll을 제거하고 Microsoft.AspNet.WebHelpers 너겟 패키지를 설치하는 것을 잊지 마십시오.
Then, make sure you have upgraded all your nuget Packages (use "Upgrade-Package") and check your dll's in web.config.
The error is probably an action in an old DLL, when you are converting your project.
In my case, a nuget installation had changed my Web.Config:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
newVersion="1.1.0.0"** should be newVersion="5.1.0.0"
Right Click to Project -> Manage Nuget Packages for solution than find
Microsoft.AspNet.Mvc and Microsoft.Net.Compilers update latest versions
I solved my problem by applying the "Install-Package Microsoft.AspNet.Mvc" command.
After that I solved my project with Web API.
I received this error when I upgraded a NuGet package - 'Microsoft.AspNet.Web Pages' version 3.2.3. I am using VS2012, starting a new vanilla 'ASP.NET MVC 4 Web Application' with template 'Internet Application' using Windows Authentication or Windows Azure authentication.
Perhaps the update is not compatible with other components, and these other components must also be upgraded. Other answers suggest updating Microsoft.AspNet.Mvc, Microsoft.Net.Compilers, and/or Microsoft.AspNet.WebHelpers.
I am working on ASP.NET Web API project and fetch same problem after adding following nuget CacheCow.Server.EntityTagStore.SqlServer
It solved installing this one
Install-Package Microsoft.AspNet.Mvc
Install-Package -Id Microsoft.AspNet.WebHelpers
Install-Package Microsoft.AspNet.Mvc -Version 5.0.0
This worked for me
'Program Club' 카테고리의 다른 글
| .a .o와 .lo 파일의 차이점 (0) | 2020.11.27 |
|---|---|
| Double.parseDouble (String)과 Double.valueOf (String)의 차이점은 무엇입니까? (0) | 2020.11.27 |
| Maven 빌드를 Gradle로 변환하는 방법은 무엇입니까? (0) | 2020.11.27 |
| npm install과 npm run build의 차이점은 무엇입니까? (0) | 2020.11.27 |
| 타이머가 아직 실행 중인지 확인할 수 있습니까? (0) | 2020.11.27 |