DLLImport 不适用于 Azure App Service Net。 3.1
DLLImport does not work on Azure App Service Net. 3.1
我最近添加的不是 C# dll to my service a which acts as HTTP Client。在我的本地机器 (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 远程调试)应用服务,当我们第一次尝试使用 DllImport 时,出现了这个异常。他声称此时没有发送网络请求。
但无论哪种方式,他都试图修复 dll 中的代理错误,但它仍然无法在 Azure 上运行。这个dll依赖的kernel.dll和msvcrt.dll应该没有问题吧?
在App Insight中我同时收到这个异常,我发送了请求,但我不确定这些异常是否相关:
启动程序集 Microsoft.AspNetCore.AzureAppServices.HostingStartup 未能执行。有关详细信息,请参阅内部异常。无法加载文件或程序集 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'。该系统找不到指定的文件。
系统信息:
OS版本:微软WindowsNT 10.0.14393.0
64位系统:正确
64 位进程:错误
处理器数量: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);
}
这个问题解决不了,因为我们不能直接在Azure上注册这个dll,我用代码尝试动态加载也不成功。推荐使用Azure Container
或virtual machine
加载此dll。
我最近添加的不是 C# dll to my service a which acts as HTTP Client。在我的本地机器 (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 远程调试)应用服务,当我们第一次尝试使用 DllImport 时,出现了这个异常。他声称此时没有发送网络请求。 但无论哪种方式,他都试图修复 dll 中的代理错误,但它仍然无法在 Azure 上运行。这个dll依赖的kernel.dll和msvcrt.dll应该没有问题吧?
在App Insight中我同时收到这个异常,我发送了请求,但我不确定这些异常是否相关: 启动程序集 Microsoft.AspNetCore.AzureAppServices.HostingStartup 未能执行。有关详细信息,请参阅内部异常。无法加载文件或程序集 'Microsoft.AspNetCore.AzureAppServices.HostingStartup, Culture=neutral, PublicKeyToken=null'。该系统找不到指定的文件。
系统信息: OS版本:微软WindowsNT 10.0.14393.0 64位系统:正确 64 位进程:错误 处理器数量: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);
}
这个问题解决不了,因为我们不能直接在Azure上注册这个dll,我用代码尝试动态加载也不成功。推荐使用Azure Container
或virtual machine
加载此dll。