从服务器下载文件时,在本地服务器上正常工作时拒绝访问

编程入门 行业动态 更新时间:2024-10-05 07:26:41
本文介绍了从服务器下载文件时,在本地服务器上正常工作时拒绝访问 - 显示错误:80070005访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Response.AddHeader("content-disposition", "attachment;filename= Salary Slip.xls") Response.ContentType = "application/octectstream" Dim path As String = Server.MapPath("~/exportedfiles") If (Directory.Exists(path) = False) Then Directory.CreateDirectory(path) End If File.Delete(path + "Salary Slip.xlsx") Dim xlAppToExport As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application xlAppToExport.Workbooks.Add("") Dim xlWorkSheetToExport As Excel.Worksheet xlWorkSheetToExport = DirectCast(xlAppToExport.Sheets("Sheet1"), Excel.Worksheet)

推荐答案

嗨 此处的问题是关于在服务器上设置权限, 在服务器上,您需要设置网络用户的访问权限, 请提供IUSR和网络用户的权利,还要向网络用户提供 文件所在的文件夹。 问题是由于访问权限冲突造成的。 Hey The problem here is about setting the rights on the server, On server you need to set the access rights to the Network User, Please provide the rights to the IUSR and the Network User, also provide the Network user to the folder in which the file is present. The issue is caused because of access right conflicts.

在基于Web的应用程序中编写互操作对象时,在IIS中部署代码时需要在下面访问权限/设置。 这是一个COM权限问题。 按照以下步骤操作 1.Start>运行> dcomcnfg(或mmc -32然后手动添加组件服务管理单元,如果在步骤3中找不到该应用程序) 2.Navigate to Component Services>电脑>我的电脑> DCOM配置 3.找到麻烦的MS应用程序(例如:Excel的Microsoft Excel应用程序或Word的Microsoft Word 97 - 2003文档) 4 。点击右键>属性 5.在安全选项卡上:选择启动和激活权限下的自定义,然后单击编辑... 6.添加网站运行的帐户(例如:网络服务)并分配本地启动和本地激活权限 -------------------------------- ---- 这似乎是Excel / Word /等在通过互操作路径启动时无法访问配置文件的问题。 1.打开Windows资源管理器 2.根据您是否安装了32位或64位版本的办公室,您需要执行以下一项(或两项): 1.32bit办公室安装:导航到C:\ Windows \ System32 \ config \systemprofile 2.64bit办公室安装:导航到C:\ Windows \ SysWOW64 \\ \\ config \systemprofile 3.验证文件夹桌面是否存在(如果不存在则创建它) 4.右键单击>属性 5.在安全选项卡上:使用默认权限添加运行站点的帐户(例如:网络服务)(读取和执行;列出文件夹内容;读取) When you code interop object in web based application, when you deploy your code in IIS you need below access permission/settings. This is a COM permissions problem. follow below steps 1.Start > Run > dcomcnfg (or "mmc -32" and then add the Component Services snap-in manually if you can’t find the app under step 3) 2.Navigate to Component Services > Computers > My Computer > DCOM Config 3.Locate the MS application giving you trouble (eg: "Microsoft Excel Application" for Excel or "Microsoft Word 97 – 2003 Document" for Word) 4.Right click > Properties 5.On the security tab: Select Customize under Launch and Activation Permissions and click Edit… 6.Add the account under which the site is running (eg: Network Service) and assign Local Launch & Local Activation permissions ------------------------------------ This seems to be an issue with Excel/Word/etc not having access to a profile when being started via the interop route. 1.Open Windows Explorer 2.Depending on whether you installed a 32bit or 64bit version of office you will need to do one┬á (or both) of the following: 1.32bit Office installation: Navigate to C:\Windows\System32\config\systemprofile 2.64bit Office installation: Navigate to C:\Windows\SysWOW64\config\systemprofile 3.Verify the folder "Desktop" exists (create it if it's not there) 4.Right click > Properties 5.On the security tab: Add the account under which the site is running (eg: Network Service) with default permissions (Read & execute; List folder contents; Read)

更多推荐

从服务器下载文件时,在本地服务器上正常工作时拒绝访问

本文发布于:2023-11-02 06:49:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551664.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器上   服务器   文件   工作

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!