DLLImport 不适用于 Azure 应用服务网络.3.1 [英] DLLImport does not work on Azure App Service Net. 3.1

查看:17
本文介绍了DLLImport 不适用于 Azure 应用服务网络.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将 not C# dll 添加到我的服务 a 中,它充当 HTTP 客户端.在我的本地机器(Windows 10)上一切正常.尝试在 Azure 上发送请求时,我得到以下响应.

I recently added not C# dll to my service a which acts as HTTP Client. On my Local Machine (Windows 10) everything works perfectly. When tried to send a request on Azure i get following response.

  <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 远程调试)应用服务,当我们第一次尝试使用 DllImport 时,发生此异常.他声称此时没有网络请求发送.但无论哪种方式,他都试图修复 dll 中的代理错误,但它仍然无法在 Azure 上运行.dll依赖于kernel.dll和msvcrt.dll应该不会有问题吧?

The developer of the dll and I debugged (VS Remote Debug) the App Service and the this exception occurs, when we first tried to use DllImport. He claims there is no network request send at this point of time. But either way he tried to fix a proxies bug in dll, but it still does not work on Azure. The dll depends on the kernel.dll and msvcrt.dll should not be a problem?

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

In App Insight I get this exception at the same time, i send the request, but i am not sure if the exceptions are related: Startup assembly Microsoft.AspNetCore.AzureAppServices.HostingStartup failed to execute. See the inner exception for more details. Could not load file or assembly 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

系统信息:操作系统版本:Microsoft Windows NT 10.0.14393.064位系统:真64 位进程:错误处理器数量:4

SystemInfo: OS version: Microsoft Windows NT 10.0.14393.0 64 bit system: True 64 bit process: False Processor count: 4

dll 位于具有正确版本的服务器上.

The dll is on the server with right Version.

这里发生了异常:

    [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);
    }

推荐答案

这个问题解决不了,因为我们无法直接在Azure上注册这个dll,也无法成功尝试用代码动态加载.推荐使用Azure Container虚拟机来加载这个dll.

This problem can't be solved, because we can't register this dll directly on Azure, and I can't succeed in trying dynamic loading with code. It is recommended to use Azure Container or virtual machine to load this dll.

这篇关于DLLImport 不适用于 Azure 应用服务网络.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆