本文介绍了URLDownloadToFile失败,代码为0x800c0008(INET_E_DOWNLOAD_FAILURE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用URLDownloadToFile下载文件,但在部分下载文件后会收到INET_E_DOWNLOAD_FAILURE。我的调用如下:

I'm trying to use URLDownloadToFile to download a file, but am getting INET_E_DOWNLOAD_FAILURE after the file is partially downloaded. My call looks like:

HRESULT hRes = ::URLDownloadToFile( NULL, strTemp, strDestination, 0, pCallback );

strTemp以下列形式提供网址:

strTemp gives the URL in the form:

https:////

https:////

pCallback是IBindStatusCallback,IHttpSecurity和IWindowForBindingUI的实现。

pCallback is an implementation of IBindStatusCallback, IHttpSecurity, and IWindowForBindingUI.

我能够让Windows显示一个对话框,警告我网站的安全证书(通过在IHttpSecurity :: OnSecurityProblem中返回S_FALSE)。

I am able to get to the point of having windows show a dialog warning me about the security certificate of the website (by returning S_FALSE in IHttpSecurity::OnSecurityProblem).

我在IBindStatusCallback :: OnProgress中接到几个调用,这个连续的ulStatus值:

I get several calls in IBindStatusCallback::OnProgress, with this succession of ulStatus values:

BINDSTATUS_PROXYDETECTING
BINDSTATUS_COOKIE_SENT
BINDSTATUS_CONNECTING
BINDSTATUS_SENDINGREQUEST

BINDSTATUS_PROXYDETECTINGBINDSTATUS_COOKIE_SENTBINDSTATUS_CONNECTINGBINDSTATUS_SENDINGREQUEST

在最后一次OnProgress调用之后,数据包嗅探器显示我从服务器下载了100多KB的数据(该文件是18+ MB。)然后我调用IBindStatusCallback :: OnStopBinding,其hResult值为INET_E_DOWNLOAD_FAILURE。

After that last OnProgress call, a packet sniffer shows that I get 100+ KB of data downloaded from the server (The file is 18+ MB.) Then I get a call to IBindStatusCallback::OnStopBinding with an hResult value of INET_E_DOWNLOAD_FAILURE.

我知道写入目标的权限目录不是问题。

I know that permission to write to the destination directory is not a problem.

我不确定我是否正确处理IBindStatusCallback :: GetBindInfo和:: OnStartBinding。以下是我的每个代码:

I am not sure whether I am handling IBindStatusCallback::GetBindInfo and ::OnStartBinding correctly. Here is my code for each:

STDMETHODIMP CDownloadCallback::GetBindInfo( DWORD* pBINDF, BINDINFO* pBindinfo )
{
   *pBINDF = BINDF_PULLDATA | BINDF_NOWRITECACHE | BINDF_GETNEWESTVERSION;
   return S_OK;
}

STDMETHODIMP CDownloadCallback::OnStartBinding( DWORD dwReserved, IBinding* pBinding )
{
   return E_NOTIMPL;
}

关于可能出现什么问题的任何想法?

Any ideas on what could be going wrong?

推荐答案

我现在也遇到这个问题,虽然我上次使用/开发程序6个月前它工作正常。但是,如果我使用管理员权限运行该程序,它可以正常工作。

I am also having this problem now, although when I last used/developed the program 6 months ago it worked fine. However if I run the program with administrator rights it works fine.

我的症状与Wayne非常相似。进程监视器显示它通过TCP与服务器通信(虽然数据比没有管理员权限时略少)它也在两种模式下调用状态回调。要下载的文件的位置是临时目录,不需要管理员权限。

My symptoms are very similar to Wayne's. Process monitors shows it communicating with the server via TCP (although slightly less data than when it doesn't have Admin rights) It is also making calls to the status callback in both modes. The location of the file to download to is the temp directory and doesn't require admin rights.

urlmon.dll的版本是日期为2014年3月的11.00.96.17041 32bit比以前使用过的更新,但这是原因还是别的什么?

The version of urlmon.dll is 11.00.96.17041 32bit dated March 2014 which is newer than the one that it was previously working with but is this the cause or something else?

这篇关于URLDownloadToFile失败,代码为0x800c0008(INET_E_DOWNLOAD_FAILURE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 18:38