Programing

오류 Microsoft.Web.Infrastructure, 버전 = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35

lottogame 2020. 9. 8. 21:53
반응형

오류 Microsoft.Web.Infrastructure, 버전 = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35


작은 웹 응용 프로그램이 있습니다. 내 응용 프로그램에 두 개의 genericHandler를 추가하기 전까지는 잘 작동했습니다.

http 처리기에 대해 다음과 같이 변경했습니다.

 <system.web>
    <authentication mode="Forms" >
        <forms protection="All" timeout="720" defaultUrl="Default.aspx" loginUrl="Login.aspx" >
        </forms>
    </authentication>
    <authorization>
        <deny users="?"/>
    </authorization>
    <compilation debug="true" targetFramework="4.0" />

    <httpHandlers>
        <!--Code Log Handler-->
        <add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory" />
        <add verb="*" type="InfoDomeNewUI.Handler.SendOWA" path="SendOWA.ashx" />
        <add verb="*" type="InfoDomeNewUI.Handler.SendSOS" path="SendSOS.ashx" />
    </httpHandlers>
    <customErrors mode="Off">
        <error statusCode="404" redirect="Templates/PageNotFound.html" />
    </customErrors>
</system.web>
<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
        <!--Code Log Handler-->
        <add name="LogHandler1" path="SendOWA.ashx" verb="*" type="InfoDomeNewUI.Handler.SendOWA"/>
        <!-- SMS SENDER-->
        <add name="SendSOS" path="SendSOS.ashx" verb="*" type="InfoDomeNewUI.Handler.SendSOS"/>
    </handlers>
</system.webServer>

Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

asp.net4.0 및 C #을 사용하고 있습니다. 로컬 호스트에서 MVC를 사용하고 있지 않습니다
.
그러나 게시 된 코드를 호스팅 할 때 위의 오류가 발생합니다.

스택 추적 :-

[FileNotFoundException : 파일 또는 어셈블리 'Microsoft.Web.Infrastructure, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35'또는 해당 종속성 중 하나를로드 할 수 없습니다. 지정한 파일을 찾을 수 없습니다.] System.Web.Http.WebHost.SuppressFormsAuthRedirectModule.Register () +0

[InvalidOperationException: The pre-application start initialization method Start on type System.Web.Http.WebHost.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +11708830 System.Web.Compilation.BuildManager.CallPreStartInitMethods() +465 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLeve

[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.Http.WebHost.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11697760 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4866485


It appears that Microsoft.Web.Infrastructure.dll is not being installed in the GAC, even if .net (4.0 or 4.5 or other) are installed successfully on Windows Server. On localhost (typically Windows client), it seems like it is being in the GAC when the tools/platform (Visual Studio etc.) are installed.

As one possible fix, please try the following:

  1. Run the following command in the Package Manager Console. (If you are using Visual Studio, this can be reached via menu options "Tools --> Library Package Manager --> Package Manager Console:)

    PM> Install-Package Microsoft.Web.Infrastructure
    

    You will see the following messages if it is successfully installed.

    Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
    Successfully added 'Microsoft.Web.Infrastructure 1.0.0.0' to Web.
    
  2. You will notice that Microsoft.Web.Infrastructure.dll has now been added as a Reference (can be seen in the references folder of your project in in Solution Explorer)

  3. If you look at the properties of this reference you will notice that "Copy Local" has been set to "True" by default.

  4. Now when you "Publish " your project, Microsoft.Web.Infrastructure.dll will be deployed.


I installed MVC4 via WPI and it helped me.


I had the same problem. When I tried the accepted answer (rockyb), I got the message that the package was already installed and assigned to my project. When I checked the references list, it was NOT referenced, however.

The Microsoft.Web.Infrastructure was installed in my solution's packages folder. Instead of using NuGet to add the package, I just used the Add Reference option. On the left side of the pop-up window, I chose Browse, and then pressed the Browse button on the bottom of the window. I navigated to the packages folder under the folder that my solution was in, then drilled down to the ...\mysolution\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40 and clicked on the Microsoft.Web.Infrastructure.dll. After clicking OK, the package showed up in my References list. I used the Web Deploy Package option to deploy my website and everything worked.


Why not copy Microsoft.Web.Infrastructure.dll file manually to the server BIN folder. This works for. My project is VS2010 Website.

This file can be located:

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40

Just copy and paste it in the BIN folder.

You probably need to include this in the web.config if you don't have it already

<compilation debug="true" targetFramework="4.0">
  <assemblies>
    <add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  </assemblies>
</compilation>

Reference: http://thedeveloperblog.com/


I found the problem. Instead of adding a class (.cs) file by mistake I had added a Web API Controller class which added a configuration file in my solution. And that configuration file was looking for the mentioned DLL (Microsoft.Web.Infrastructure 1.0.0.0). It worked when I removed that file, cleaned the application and then published.


After installing Microsoft.Web.Infrastructure through Nuget-Package Manager

PM> Install-Package Microsoft.Web.Infrastructure

Copy the Microsoft.Web.Infrastructure.dll manually from the Nuget-Package folder on your web application and then paste it in your bin folder of your web application deployed on the web server.

packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll

It worked for me.


Update-Package -reinstall Microsoft.Web.Infrastructure didn't work for me, as I kept receiving errors that it was already installed.

I had to navigate to the Microsoft.Web.Infrastructure.1.0.0.0 folder in the packages folder and manually delete that folder.

After doing this, running Install-Package Microsoft.Web.Infrastructure installed it.

Note: CopyLocal was automatically set to true.


I had the same problem and the "Microsoft.Web.Infrastructure.dll" appeared to be missing. I have tried few advises and installed MVC`s etc. and nothing helped. The solution was to install "Web Services Enhancements (WSE) 1.0 SP1 for Microsoft .NET" which includes Microsoft.Web.Infrastructure.dll. Available at: http://www.microsoft.com/en-gb/download/details.aspx?id=4065


I had the same problem. I tried installing Visual Studio 2010 SP1 but it didn't worked.

Finally I get Microsoft.Web.Infrastructure.dll from the colleague. You can find the dll into your friends PC where the project is perfectly working. Try to search dll into Temp/Temporary ASP.NET Files. Go to Temp using %temp% into run window.

After getting dll into your pc, just add reference to your project and it will work.


Republishing the site fixed the issue for me.


Was facing the same issue and unfortunately nothing here was working. Finally, I came across this link: https://blogs.msdn.microsoft.com/jjameson/2009/11/18/the-copy-local-bug-in-visual-studio/

Turns out the solution is sort of dumb: set copy-local for the microsoft.web.infrastructure dll to False, then set it back to True.

By the way, I think what is happening is that there are two versions of the microsoft.web.infrastructure dll, one that is pre-installed in the GAC, and another one that is now a nuget package. I think one is masking the other, hence causing issues. In my particular case, on my build server, I need it to be copied over to a folder (this folder is then zipped and sent off to deployment). I guess the system had a copy locally and just thought "nah, it'll be fine"


I have a files only website. Added MVC 5 to webforms application (targeting net45). I had to modify the packages.config

package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45"

to

package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" developmentDependency="true"

in order for it to startup on local box in debug mode (previously had the top described error). Running VS 2017 on Windows 7...opened through File > Open > Web Site > File (chose root directory outside of IIS).


I had the same problem after upgrading a bunch of NuGet packages.
I have tried all kinds of deleting, cleaning, resintalling described here and beyong to no avail. The references did not have Microsoft.Web.Infrastructure despite the NuGet manager showed it was installed.

The problem was solved by replacing:

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

with

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

in packages.config. The culprit is apparently "net45".

참고URL : https://stackoverflow.com/questions/12669206/error-microsoft-web-infrastructure-version-1-0-0-0-culture-neutral-publickeyt

반응형