gpt4 book ai didi

asp.net - 错误 Microsoft.Web.Infrastruct,版本 = 1.0.0.0,文化 = 中性,PublicKeyToken = 31bf3856ad364e35

转载 作者:行者123 更新时间:2023-12-03 05:01:17 25 4
gpt4 key购买 nike

我有一个小型网络应用程序。在我在应用程序中添加两个 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: 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.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

最佳答案

即使 .net(4.0 或 4.5 或其他)已成功安装在 Windows Server 上,GAC 中似乎也未安装 Microsoft.Web.Infrastruct.dll。在本地主机(通常是 Windows 客户端)上,安装工具/平台(Visual Studio 等)时,它似乎位于 GAC 中。

作为一种可能的修复方法,请尝试以下操作:

  1. 在程序包管理器控制台中运行以下命令。 (如果您使用的是 Visual Studio,可以通过菜单选项“工具 --> 库包管理器 --> 包管理器控制台:)

    PM> Install-Package Microsoft.Web.Infrastructure

    如果安装成功,您将看到以下消息。

    Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
    Successfully added 'Microsoft.Web.Infrastructure 1.0.0.0' to Web.
  2. 您会注意到 Microsoft.Web.Infrastruct.dll 现已添加为引用(可以在解决方案资源管理器中项目的引用文件夹中看到)

  3. 如果您查看此引用的属性,您会发现“复制本地”默认设置为“True”。

  4. 现在,当您“发布”项目时,Microsoft.Web.Infrastruct.dll 将被部署。

关于asp.net - 错误 Microsoft.Web.Infrastruct,版本 = 1.0.0.0,文化 = 中性,PublicKeyToken = 31bf3856ad364e35,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12669206/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com