Could not load file or assembly 'Microsoft.Web.Infrastructure,

后端 未结 20 2014
走了就别回头了
走了就别回头了 2020-12-09 00:57

I tried to upload my web site to a server. It was working fine with my local host, so I uploaded everything in my localhost wwwroot folder to the server and cha

相关标签:
20条回答
  • 2020-12-09 01:07

    You need to download the ASP.NET MVC framework on the server hosting your application. It's a quick fix just download and install from here (This is the MVC 3 framework http://www.asp.net/mvc/mvc3), then boom you are good to go.

    0 讨论(0)
  • 2020-12-09 01:09

    It turns out after doing a Reference Cleaning, it removed Microsoft.Web.Infrastructure, but not from the packages.config file. After trying to add it again using the Package Manager Console, Visual Studio says that it is already installed which is false because it was removed.

    I then removed the line of code in the packages.config file

    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
    

    and ran the command again

    PM> Install-Package Microsoft.Web.Infrastructure
    

    After this, now it works fine.

    0 讨论(0)
  • 2020-12-09 01:10

    For me Microsoft.Web.Infrastructure.dll was missing from the bin folder, it wasn't set to copy local in the project. Copied the dll from another project in the solution and the page loads.

    0 讨论(0)
  • 2020-12-09 01:11

    You will need to include the dll with your project and add a reference to it as well.

    Here is a link to a similar issue already on Stack: MVC3 Deployment Dependency Problems

    0 讨论(0)
  • 2020-12-09 01:13

    Resharper detected Microsoft.Web.Infrastructure as an unused reference an so I deleted it. Locally was working fine but then I got the same error after publishing to dev.

    Conclusion, beware when deleting references marked as unused by Resharper

    0 讨论(0)
  • 2020-12-09 01:15

    I had to set "Copy Local" in the Reference Properties to False, then back to True. Doing this added the Private True setting to the .csproj file.

    <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
          <Private>True</Private>
        </Reference>
    

    I had assumed this was already set, since the "Copy Local" showed as True.

    0 讨论(0)
提交回复
热议问题