gpt4 book ai didi

c# - 无法加载文件或程序集 'DocumentDB.Spatial.Sql' 或其依赖项之一

转载 作者:行者123 更新时间:2023-11-30 15:56:16 25 4
gpt4 key购买 nike

我将所有 nuget 软件包更新到最新版本。无论是在调试还是发布中,一切都在本地运行良好,但是一旦我发布到 azure,我就会在网站主页上看到此信息:

[FileLoadException: Could not load file or assembly 'DocumentDB.Spatial.Sql' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +457
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48

[ConfigurationErrorsException: Could not load file or assembly 'DocumentDB.Spatial.Sql' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +729
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +247
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +157
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +226
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +73
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +321
System.Web.Compilation.BuildManager.ExecutePreAppStart() +170
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +878

[HttpException (0x80004005): Could not load file or assembly 'DocumentDB.Spatial.Sql' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +525
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +124
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +700

这些是已安装的 Nuget 软件包:

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="jQuery" version="3.2.1" targetFramework="net452" />
<package id="Microsoft.AspNet.SignalR" version="2.2.2" targetFramework="net452" />
<package id="Microsoft.AspNet.SignalR.Core" version="2.2.2" targetFramework="net452" />
<package id="Microsoft.AspNet.SignalR.JS" version="2.2.2" targetFramework="net452" />
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.2.2" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.Azure.DocumentDB" version="1.18.0" targetFramework="net452" />
<package id="Microsoft.Azure.DocumentDB.ChangeFeedProcessor" version="1.2.0" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.8" targetFramework="net452" />
<package id="Microsoft.Net.Compilers" version="2.4.0" targetFramework="net452" developmentDependency="true" />
<package id="Microsoft.Owin" version="4.0.0-alpha1" targetFramework="net452" />
<package id="Microsoft.Owin.Host.SystemWeb" version="4.0.0-alpha1" targetFramework="net452" />
<package id="Microsoft.Owin.Security" version="4.0.0-alpha1" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" />
</packages>

发布构建日志:

1>------ Publish started: Project: redacted, Configuration: Release Any CPU ------
1>Transformed Web.config using C:\Projects\redacted\redacted\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
1>Auto ConnectionString Transformed obj\Release\TransformWebConfig\transformed\Web.config into obj\Release\CSAutoParameterize\transformed\Web.config.
1>Copying all files to temporary location below for package/publish:
1>obj\Release\Package\PackageTmp.
1>Start Web Deploy Publish the Application/package to https://redacted.scm.azurewebsites.net/msdeploy.axd?site=redacted ...
1>Adding ACLs for path (redacted)
1>Adding ACLs for path (redacted)
1>Updating file (redacted\bin\DocumentDB.Spatial.Sql.dll).
1>Updating file (redacted\bin\redacted.dll).
1>Updating file (redacted\bin\Microsoft.Azure.Documents.Client.dll).
1>Updating file (redacted\bin\Microsoft.Azure.Documents.ServiceInterop.dll).
1>Updating file (redacted\packages.config).
1>Updating file (redacted\Web.config).
1>Adding ACLs for path (redacted)
1>Adding ACLs for path (redacted)
1>Publish Succeeded.
1>Web App was published successfully http://redacted.azurewebsites.net/
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

您可以看到目标 DLL 在构建过程中被添加到包中。

我无法让它脱离这种状态 - 它位于开发服务器上,现在我的前端开发人员变得焦虑。

我尝试回滚 DocumentDB,但没有帮助。这是在我不情愿地决定更新 nuget 包之后发生的。

看起来 DocumentDB.Spatial.Sql.dll 文件甚至不是 .net 程序集。为什么它要尝试这样加载它?它只是一个 native 64 位 DLL。

这是我在 azure 网站上部署的项目的图像: enter image description here

最佳答案

因此,如果其他人遇到此问题或类似问题,则这是发布工具的错误。我为解决这个问题所做的事情是:

  1. 更新所有 Nuget 软件包
  2. 关闭 Visual Studio
  3. 删除本地 project\binproject\obj 目录
  4. 打开 Visual Studio 并重建 RELEASE 包
  5. 转到 Azure Web 应用并停止该应用
  6. 打开 FTP 客户端,连接到您的网站
  7. 删除/site/wwwroot/bin目录下的所有文件
  8. 手动将project\bin目录下的所有文件上传到/site/wwwroot/bin目录
  9. 启动您的 Azure Web 应用

这让我的一切再次正常运转。

我的想法是旧的 Nuget 包中遗留的一些东西导致了冲突。这只是确保在您更新 Nuget 软件包后,您的实时网站将从头开始。

关于c# - 无法加载文件或程序集 'DocumentDB.Spatial.Sql' 或其依赖项之一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47118296/

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