Programing

파일 또는 어셈블리 'System.Web.Mvc'를로드 할 수 없습니다

lottogame 2020. 5. 10. 10:12
반응형

파일 또는 어셈블리 'System.Web.Mvc'를로드 할 수 없습니다


새로운 ASP.NET MVC 웹 응용 프로그램은 개발 워크 스테이션에서 작동하지만 웹 서버에서는 실행되지 않습니다 ...


'/'응용 프로그램에 서버 오류가 있습니다.


구성 오류

설명 : 이 요청을 처리하는 데 필요한 구성 파일을 처리하는 중에 오류가 발생했습니다. 아래의 특정 오류 세부 사항을 검토하고 구성 파일을 적절하게 수정하십시오.

파서 오류 메시지 : 파일 또는 어셈블리 'System.Web.Mvc, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'또는 해당 종속성 중 하나를로드 할 수 없습니다. 시스템이 지정된 파일을 찾을 수 없습니다.

소스 오류 :

Line 44:         <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 45:         <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 46:         <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
Line 47:         <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 48:         <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

소스 파일 : C : \ inetpub \ www.example.org \ web.config 라인 : 46

어셈블리로드 추적 : 다음 정보는 'System.Web.Mvc, 버전 = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35' 어셈블리를로드 할 수없는 이유를 확인하는 데 도움이 될 수 있습니다.

WRN : 어셈블리 바인딩 로깅이 꺼져 있습니다.
어셈블리 바인드 실패 로깅을 사용하려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD)를 1로 설정하십시오.
참고 : 어셈블리 바인드 실패 로깅과 관련하여 일부 성능 저하가 있습니다.
이 기능을 끄려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog]를 제거하십시오.

버전 정보 : Microsoft .NET Framework 버전 : 2.0.50727.3053; ASP.NET 버전 : 2.0.50727.3053


서버에 AspNetMVCBeta-setup.msi 를 설치해야 합니까? 아니면 다른 서버용 설치 프로그램이 있습니까?

여기에 이미지 설명을 입력하십시오


방금이 문제를 해결하는 블로그 게시물을 작성했습니다. 서버에 ASP.NET MVC를 설치하거나 여기단계를 수행 할 수 있습니다 .


편집 : (jcolebrand에 의해) 나는이 링크를 통과 한 다음 아래 Victor 와 같은 문제가 있었으므로 다음을 추가하는 것이 좋습니다.

* Microsoft.Web.Infrastructure
* System.Web.Razor
* System.Web.WebPages.Deployment
* System.Web.WebPages.Razor

나는 sgriffinusa와 같은 문제에 부딪쳤다. Phil의 기사 외에도 http://www.haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx를 참조하십시오 . 나는 이것을 추가했다 :

* Microsoft.Web.Infrastructure
* System.Web.Razor
* System.Web.WebPages.Deployment
* System.Web.WebPages.Razor

GoDaddy 배포는 완벽하게 작동했습니다. 사용자 정의 오류를 끄고 참조를 추가하여 오류를 수정하십시오. 올바른 방향으로 인도해야합니다.


웹 서버에 직접 MVC를 설치하는 것이 하나의 옵션입니다. 어셈블리는 GAC에 설치됩니다. 어셈블리를 빈으로 배포 할 수도 있습니다. 이렇게하면 최종 릴리스가 제공 될 때까지 서버가 시험판 어셈블리에서 멀어지게 할 수 있습니다.

Phil Haack은 며칠 전에 앱과 함께 MVC를 배포하는 방법에 대한 멋진 기사를 게시 했으므로 직접 설치할 필요가 없습니다.

http://www.haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx


GoDaddy 공유 호스팅에 MVC3 Razor 웹 응용 프로그램을 배포하려고하는 것과 동일한 문제가 발생했습니다. 참조해야 할 추가 .dll이 있습니다. 자세한 내용은 여기 : http://paulmason.biz/?p=108

기본적으로 @Haacked의 게시물에 나열된 것 외에도 다음에 대한 참조를 추가하고 설명에 따라 로컬로 배포하도록 설정해야합니다.

  • Microsoft.Web. 인프라
  • System.Web.Razor
  • System.Web.WebPages.Deployment
  • System.Web.WebPages.Razor

VS2010의 솔루션 탐색기에서 프로젝트를 마우스 오른쪽 단추로 클릭하고 '배포 가능한 종속성 추가'를 선택하십시오. 그런 다음 다음 대화 상자에서 MVC 관련 확인란을 선택하십시오.

다른 답변에서 언급 한 모든 .dll 파일이 들어있는 '_bin_deployableAssemblies'폴더가 프로젝트에 생성됩니다. 배포 패키지를 만들 때 bin 폴더에 복사된다고 생각합니다.


간단한 수정. VS2010에서 MVC 프로젝트를 마우스 오른쪽 단추로 클릭하고 "배포 가능한 종속성 추가 ..."를 선택한 다음 원하는 옵션을 선택하고 확인을 클릭하십시오.


빠르고 간단한 솔루션 : Microsoft.AspNet.Mvc -Version 5.2.3 에서이 문제에 직면 했으며이 모든 스레드를 거친 후 가장 간단한 해결책을 찾았습니다.

다음 단계를 따르십시오.

  1. 프로젝트를 위해 Visual Studio에서 NuGet Package Manager를 엽니 다.
  2. Microsoft.AspNet.Mvc를 검색하십시오.
  3. 발견되면 조치를 설치 제거 및 설치 제거로 변경하십시오.
  4. 완료되면 다시 설치하고 지금 시도하십시오

이렇게하면 참조와 관련된 모든 문제가 자동으로 해결됩니다. 아래 이미지를보십시오 :

여기에 이미지 설명을 입력하십시오


우리는 그것을 사용하는 클래스 라이브러리를 만들고 있기 때문에 그것을 추가하고 싶습니다.

나를 위해 여기 있습니다 ...

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies


같은 문제가 있었고 그들이 말한 모든 어셈블리를 추가했지만 여전히 같은 오류가 발생했습니다.

" Specific Version "= False 를 만들어야합니다 .

특정 버전은 거짓이어야합니다.


호스팅 제공 업체를 사용하지 않고 서버에 액세스하여 설치할 수있는 경우 ... MVC 3 업데이트 도구를 설치하면 Windows 2003 서버 / IIS6 컴퓨터에서 몇 시간의 문제를 줄일 수 있습니다. , 나는이 페이지에 Nuget.Core.dll 버전 번호가 일치하지 않습니다.


In addition to the Haack post, Hanselman also has a similar post. BIN Delploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed

For me, the "Copy Local = true" solution was insufficient because my Website's project references did not include all the dlls that were missing. As Scott mentions in his post, I also needed to get additional dlls from the following folder on my development box: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies. The error message informed me which dll was missing (System.Web.Infrastructure, System.Web.Razor, etc.) I continued to add each missing dll, one by one, until it worked.


I've did a "Update-Package –reinstall Microsoft.AspNet.Mvc" to fix it in Visual Studio 2015.


Also check the version of the assembly in the web.config inside your Views folder and make sure it matches. I sometimes forget there is a 2nd web.config in that location.


This blog post could be a duplicate of Phil's but it might help:

http://www.tugberkugurlu.com/archive/deployment-of-asp-net-mvc-3-rc-2-application-on-a-shared-hosting-environment-without-begging-the-hosting-company


I had the same problem with a bunch of assembly files after moving the project to another solution.

For me, the web.config file was trying to add this assembly:

<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Thought the reference in the project was pointing towards version 3.0.0.0 (click on the reference and scroll to the bottom of the properties). Hence I just changed the reference version in the web.config file.

I don´t know if this was just a bug of some sort. The problem with adding all the other references was that the references appeared in the config file but it wasn't actually referenced at all in the project (inside the solution explorer) and the needed files were not copied with the rest of the project files, probably due to not being "copy local = true"

Now, I wasn´t able to find these assemblies in the addable assemblies (by right clicking the reference and trying to add them from the assemblies or extensions). Instead I created a new MVC solution which added all the assemblies and references I needed, and finding them under the new projects references in the solution explorer and finding their path in the properties window for the reference.

Then I just copied the libraries I needed into the other project and referenced them.


An important consideration is the web.config file, Some packages can mangle your binding redirects causing havoc (the rogue package was in house package that I did not remove the web.config from the package or making sure the web.config in in the package doesn't have any binding redirects. For example by removing the duplicate and incorrect node resolves this

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>


                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
                <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
                <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
                <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>


                <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="SimpleInjector" publicKeyToken="984cb50dea722e99" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.3.2.0" newVersion="3.3.2.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral"/>
                <bindingRedirect oldVersion="0.0.0.0-1.4.9.5" newVersion="1.4.9.5"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>

by removing lines 8 to 24 fixes the build.


After trying everything and still failing this was my solution: i remembered i had and error last updating the MVC version in my Visual studio so i run the project from another Visual studio (different computer) and than uploaded the dll-s and it worked. maybe it will help someone...


I am using Jenkins with .net projects and had troubles with MVC 4 references.

I finallys solved my issue by using a .Net reference search engine functionality based on the registry using :

"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v2.0.50727\AssemblyFoldersEx"

You can create subkey et set the default key to "c:\myreferenceedir" for example.

It saved me with MVC versions and also ASP.net Web pages.

Usefull to add references to the "Add Reference Dialog"

http://dhakshinamoorthy.wordpress.com/2011/12/04/how-to-register-your-net-assembly-in-gac-and-make-it-show-in-add-reference-dialog/


As Others have mentioned, add these refernces to visual studios with Copy Local set to true. ( I also had to add System.Web.Webpages)

Microsoft.Web.Infrastructure
System.Web.Razor
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Web.Webpages

I added "Microsoft ASP.NET Razor" using Manage NuGet Packages.

참조 추가를 사용하면 어떤 이유로 든 System.Web.Helpers 1.0.0 및 2.0.0 만 있었지만 3.0.0은 없었습니다.

또 다른 옵션은 System.Web.Mvc 및 System.Web.Http에 대한 참조를 삭제 한 다음 csproj 파일의 패키지 위치를 찾아 다시 추가하는 것입니다 (가장 쉽게 프로젝트를 편집 할 수 있음) 텍스트 편집기) :

<Reference Include="System.Web.Http">
  <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>

<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>

참고 URL : https://stackoverflow.com/questions/267006/could-not-load-file-or-assembly-system-web-mvc

반응형