热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

解决网络下载句柄无效。(异常来自HRESULT:0x80070006(E_HANDLE))

首先要共享该文件其次在安全里加IISSHARED是IIS账号下载代码#region下载下载

首先要共享该文件

其次 在安全里加IISSHARED 是IIS账号

 

下载代码

  #region 下载
        ///


        /// 下载
        ///

        ///
        ///
        [LoginFilter]
        public ActionResult FilePathDownload(string strPath)
        {
            int index = strPath.LastIndexOf(@"\");
            string fileName = "";
            if (index > 0)  
            {
                fileName = strPath.Substring(index + 1, strPath.Length - index - 1);
            }
            int fileIndex=strPath.IndexOf(@"\OrderFiles\");
            var path = Server.MapPath("~/OrderFiles/" + strPath.Substring(fileIndex).Replace("\\", "//"));
            return File(path, "application/x-zip-compressed", fileName);
            
        }
        #endregion

 

页面

 
      订单附件:
      
                        @if (Model.OrderFilesList.ToList().Count > 0)
                        {
                            var filePath = @Model.OrderFilesList.ToList().FirstOrDefault();
                            下载附件
                          
                            using (Ajax.BeginForm("FilePathDownload", "ForeignTradeOrder", new { strPath = @filePath.FilePath }, new AjaxOptions
                            {
                                HttpMethod = "Post"
                            }, new { id = "myForm" }))
                            {
                               下载附件
                              
                            }
                        }
                        else
                        {
                            
                        }
                       
          

//下载
 function downLoadClick() {
    document.getElementById('myForm').submit();
}

IIS配置站点如下 站点下的虚拟目录盘符的路径如下

转:https://www.cnblogs.com/liufei88866/p/3591795.html



推荐阅读
author-avatar
滴滴答2502906673
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有