[英]DllImport entry point for Interop function not found in ieframe.dll running under Azure
In my C# app that's running under Azure, I need to use Interop / DllImport to call 'IEGetProtectedModeCookie' in ieframe.dll 在运行于Azure下的C#应用程序中,我需要使用Interop / DllImport在ieframe.dll中调用“ IEGetProtectedModeCookie”
Here's the signature: 这是签名:
[DllImport("ieframe.dll", CharSet = CharSet.Unicode, EntryPoint = "IEGetProtectedModeCookie", SetLastError = true)]
public static extern int IEGetProtectedModeCookie(String url, String cookieName, StringBuilder cookieData, ref int size, uint flag);
I've added ieframe.dll to my project's bin directory, and I have a reference to SHDocVw that generates the Debug or Retail Interop.SHDocVw.dll file in my obj directory. 我已经将ieframe.dll添加到了项目的bin目录中,并且引用了在我的obj目录中生成Debug或Retail Interop.SHDocVw.dll文件的SHDocVw 。
When I test this on my dev box, everything works fine, but when I deploy to Azure, I'm getting the following runtime error: 当我在开发箱上对此进行测试时,一切正常,但是当我部署到Azure时,出现以下运行时错误:
System.EntryPointNotFoundException: Unable to find an entry point named 'IEGetProtectedModeCookie' in DLL 'ieframe.dll'.
System.EntryPointNotFoundException:无法在DLL“ ieframe.dll”中找到名为“ IEGetProtectedModeCookie”的入口点。 at Predicere.Utilities.LoginUtils.IEGetProtectedModeCookie(String url, String cookieName, StringBuilder cookieData, Int32& size, UInt32 flag) at Predicere.Utilities.LoginUtils.GetProtectedModeIECookieValue(String cookieName, Boolean isFacebookPage) in blah...
在Predicere.Utilities.LoginUtils.GetProtectedModeIECookieValue(String cookieName,Boolean isFacebookPage)在Predicere.Utilities.LoginUtils.IEGetProtectedModeCookie(String url,字符串cookieName,StringBuilder cookieData,Int32&大小,UInt32标志)
What am I missing here? 我在这里想念什么?
IEGetProtectedModeCookie was introduced with IE8. IEGetProtectedModeCookie与IE8一起引入。 Could it be that only IE6 or IE7 is installed?
可能仅安装了IE6或IE7吗?
So, we finally found a solution using feedback from SO on another separate but related issue. 因此,我们终于找到了一个解决方案,该解决方案使用了来自SO的反馈来解决另一个单独但相关的问题。
The problem is that IEGetProtectedModeCookie was not introduced until IE8, but the baseline Azure web instance is based on IE7. 问题在于,直到IE8才引入IEGetProtectedModeCookie,但是基准Azure Web实例基于IE7。
The OS flavor is controlled by the osFamily attrib in : 操作系统风格由osFamily attrib控制:
<ServiceConfiguration serviceName="Foobar" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
This setting installs Windows Server 2008 SP2, which is based on IE7. 此设置将安装基于IE7的Windows Server 2008 SP2。
If we modify the osFamily attrib as follows, we end up with Windows Server 2008 R2, which is based on IE8: 如果我们按如下方式修改osFamily属性,则最终会得到基于IE8的Windows Server 2008 R2:
<ServiceConfiguration serviceName="Foobar" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*">
More details can be found in this blog entry, especially if you want to upgrade you Azure instance to use IE9 (which, it turns out, is non-trivial). 可以在此博客条目中找到更多详细信息,特别是如果您想升级Azure实例以使用IE9(事实证明,这是很简单的)。
http://sajojacob.com/blog/2011/03/startup-tasks-elevated-privileges-vm-role/ http://sajojacob.com/blog/2011/03/startup-tasks-elevated-privileges-vm-role/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.