DLLImport在Azure App Service Net上不起作用.3.1 [英] DLLImport does not work on Azure App Service Net. 3.1

查看:77
本文介绍了DLLImport在Azure App Service Net上不起作用.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近没有将C# dll 添加到我的服务HTTP中,该服务充当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远程调试)App Service,并且在我们首次尝试使用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.

SystemInfo:操作系统版本:Microsoft Windows NT 10.0.14393.064位系统:真64位进程:False处理器数量: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容器虚拟机加载此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 App Service Net上不起作用.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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