代码之家  ›  专栏  ›  技术社区  ›  Jamie

.NET Core 2.0-Azure函数,程序集运行时解析期间出现异常

  •  0
  • Jamie  · 技术社区  · 8 年前

    我正在运行一个。NET Standard 2.0 Azure函数,该函数引用了其他函数。NET标准2.0类库。

    我能够构建引用类库的函数。但是,当我运行使用类库的特定函数时,会出现异常。

    Exception during runtime resolution of assembly 'StorageQueueStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null': 'System.InvalidCastException: [A]System.AppDomain cannot be cast to [B]System.AppDomain. Type A originates from 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.5\System.Private.CoreLib.dll'. Type B originates from 'System.Runtime.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.5\System.Runtime.Extensions.dll'.
        [21-2-2018 08:48:47]    at Microsoft.Azure.WebJobs.Script.Description.FunctionAssemblyLoader.ResolveAssembly(Object sender, ResolveEventArgs args) in C:\azure-webjobs-sdk-script\src\WebJobs.Script\Description\DotNet\FunctionAssemblyLoader.cs:line 69'
        [21-2-2018 08:48:47] Unable to find assembly 'StorageQueueStandard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Are you missing a private assembly file?
    

    “StorageQueueStandard”是类库的名称。

    2 回复  |  直到 8 年前
        1
  •  0
  •   Joey Cai    8 年前

    [A] 系统。AppDomain无法强制转换到[B]系统。AppDomain。

    当从不同的DLL加载程序集时,可能会发生这种情况。

    如错误所示,这两个系统。私有的CoreLib和System。运行时。扩展具有系统。AppDomain。

    请检查您的代码并参考此 issue . 问题表明 .NET Core在运行时尚不支持ServiceBus触发器 .

    我不清楚您在哪里有这个错误,所以如果您仍然有这个问题,希望您能向我展示更详细的代码和描述。

        2
  •  0
  •   Jamie    8 年前

    为了解决我的问题,我删除了我的项目并创建了一个新的azure。net标准函数。

    之后,我降级了WindowsAzure。存储至8.6.0。

    有关更多信息,请访问: https://github.com/Azure/azure-functions-core-tools/issues/322

    推荐文章