【问题标题】:Azure function failing to Load Nuget package - Working locallyAzure 函数无法加载 Nuget 包 - 在本地工作
【发布时间】:2020-02-04 17:51:54
【问题描述】:

我一直在开发一个 azure 函数,它会接收加密数据并对这些数据进行一些操作然后返回。但是,我遇到了 Microsoft SEAL Nuget 包的问题。当我在本地运行我的函数时没有问题并且我可以使用该包,但是当我将我的函数发布到 azure 时,我收到一条警告:

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\Kyle\.nuget\packages\microsoft.research.sealnet\3.4.5\lib\netstandard2.0\SEALNet.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
1>FunctionApp3 -> C:\Users\Kyle\source\repos\FunctionApp3\bin\Release\netcoreapp3.0\bin\FunctionApp3.dll
1>Done building project "FunctionApp3.csproj".
2>------ Publish started: Project: FunctionApp3, Configuration: Release Any CPU ------
2>There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\Users\Kyle\.nuget\packages\microsoft.research.sealnet\3.4.5\lib\netstandard2.0\SEALNet.dll", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
2>FunctionApp3 -> C:\Users\Kyle\source\repos\FunctionApp3\bin\Release\netcoreapp3.0\bin\FunctionApp3.dll
2>FunctionApp3 -> C:\Users\Kyle\source\repos\FunctionApp3\obj\Release\netcoreapp3.0\PubTmp\Out\
2>    Could not evaluate 'sealnetnative.dll' for extension metadata. Exception message: Bad IL format.
2>Publishing C:\Users\Kyle\source\repos\FunctionApp3\obj\Release\netcoreapp3.0\PubTmp\FunctionApp3 - 2020020416504394.zip to https://functionapp320200204042055.scm.azurewebsites.net/api/zipdeploy...
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

函数仍然发布到 azure,但是当我尝试发送请求时,我收到错误 500,这仅在使用 SEAL 功能时。当我检查天蓝色的功能洞察力时,失败给出了错误: Could not load file or assembly 'SEALNet, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 根据我的研究,我认为这可能是一个依赖问题,但是我无法解决这个问题。如果我的格式不正确,请提前感谢。欢迎编辑。

【问题讨论】:

    标签: c# .net azure azure-functions seal


    【解决方案1】:

    根据报错信息:

    项目的处理器架构不匹配 正在构建的“MSIL”和参考处理器架构 "C:\Users\Kyle.nuget\packages\microsoft.research.sealnet\3.4.5\lib\netstandard2.0\SEALNet.dll", “AMD64”

    尝试在 .csproj 中定义以下设置:

    <PlatformTarget>x64</PlatformTarget>
    

    【讨论】:

    • 感谢您的回复!我将此添加到我的 .csproj 中,但是当我向函数发送请求时,我现在收到“函数主机未运行”消息。谢谢。
    • 你最好检查一下日志流。似乎它没有正确编译/执行。如果您遇到此类问题,也许更好的方法是将所有内容 dockerize 并在 Container Instance 上运行,然后使用 azure 函数来调用 ACI
    • 感谢您的反馈,我会调查的。我只是使用 azure 的新手,我希望能够使用安装的 nuget 从 VS 发布应用程序,然后从我的 WebApp 发送请求。
    猜你喜欢
    • 1970-01-01
    • 2020-04-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-07
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多