我已经将所有的NuGet包更新到最新版本。在本地调试或发布模式下,一切都很正常,但是一旦我发布到Azure上,网站主页就会出现以下问题:
发布构建日志:
在构建过程中,您可以看到目标DLL被添加到软件包中。
我无法将其从此状态中移出 - 它在开发服务器上,现在我的前端开发人员变得焦虑了。
我尝试回滚DocumentDB,但没有帮助。这是在我不情愿地决定更新nuget包之后发生的。
看起来DocumentDB.Spatial.Sql.dll文件甚至不是.net程序集。为什么它要尝试将其作为这样的程序加载?它只是一个本机64位DLL。
这是我在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程序集。为什么它要尝试将其作为这样的程序加载?它只是一个本机64位DLL。
这是我在Azure网站上部署的项目的图像:
![enter image description here](https://istack.dev59.com/L4fbO.webp)