DLLImport不适用于Azure App Service Net。 3.1

问题描述 投票:0回答:1

我最近没有将C#dll添加到充当HTTP Client的服务a中。在我的本地计算机(Windows 10)上,一切正常。尝试在Azure上发送请求时,得到以下响应。

  <h3>There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.</h3> 

dll的开发人员和我调试(VS远程调试)App Service,并且在我们首次尝试使用DllImport时发生此异常。他声称此时没有网络请求发送。但是,无论哪种方式,他都试图修复dll中的代理错误,但在Azure上仍然无法使用。 dll取决于kernel.dll和msvcrt.dll应该不是问题吗?

在App Insight中,我同时收到此异常,我发送了请求,但不确定这些异常是否相关:启动程序集Microsoft.AspNetCore.AzureAppServices.HostingStartup无法执行。有关更多详细信息,请参见内部异常。无法加载文件或程序集'Microsoft.AspNetCore.AzureAppServices.HostingStartup,Culture = neutral,PublicKeyToken = null'。该系统找不到指定的文件。

SystemInfo:操作系统版本:Microsoft Windows NT 10.0.14393.064位系统:真64位进程:False处理器数量:4

该dll在具有正确版本的服务器上。

这里发生异常:

    [DllImport(LIB_32, EntryPoint = SYMBOL_FREE)]
    internal static extern void Free32(IntPtr response);

    [DllImport(LIB_64, EntryPoint = SYMBOL_FREE)]
    internal static extern void Free64(IntPtr response);

    [DllImport(LIB_32, EntryPoint = SYMBOL_INVOKE)]
    internal static extern IntPtr Invoke32([In] byte[] request);

    [DllImport(LIB_64, EntryPoint = SYMBOL_INVOKE)]
    internal static extern IntPtr Invoke64([In] byte[] request);

    protected override IntPtr PerformInvokeForArchitecure(byte[] request)
    {
        if (Is64BitSystem)
        {
            return Invoke64(request);
        }

        return Invoke32(request);
    }
c# azure asp.net-core .net-core dllimport
1个回答
0
投票

无法解决此问题,因为我们无法直接在Azure上注册此dll,并且我无法成功尝试使用代码进行动态加载。建议使用Azure Containervirtual machine加载此dll。

© www.soinside.com 2019 - 2024. All rights reserved.