移动端使用Dio发送 FormData, 请求类型 multipart/form-data, FormData内可以一个或多个包含文件时。

请求接口时获取上传的fomdata数据使用 System.Web.HttpContext.Current.Request 接受时  报索引超出数组界限问题。

使用MultipartFormDataStreamProvider接受数据不受影响。

解决过程不多说。说多了都是泪。下面是解决方案

解决方法:

1.修改IIS的applicationhost.config

a.文件位置: %windir%/system32/inetsrv/config/applicationhost.config

b.找到 <requestFiltering> 节点

c.然后找到<serverRuntime />此项。如果设置了uploadReadAheadSize的大小  则删除掉就可以了。

附加知识点:

iis7上传文件大小是有限制的。根据自己需求来进行设置相对应的处理

1.web.config中添加如下内容

<configuration>
<system.web>
<httpRuntime maxRequestLength="上传大小的值(单位:byte)" executionTimeout=""/>
</system.web>
</configuration>

2.web.config中,把以下内容加在<system.webServer>节点

<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="上传大小的值(单位:KB)" >
</requestLimits>
</requestFiltering>
</security>

.NET System.Web.HttpContext.Current.Request报索引超出数组界限。的更多相关文章

  1. System.Web.HttpContext.Current.Request用法

    public static void SetRegisterSource() { if (System.Web.HttpContext.Current.Request["website&qu ...

  2. 为什么获取的System.Web.HttpContext.Current值为null,HttpContext对象为null时如何获取程序(站点)的根目录

    ASP.NET提供了静态属性System.Web.HttpContext.Current,因此获取HttpContext对象就非常方便了.也正是因为这个原因,所以我们经常能见到直接访问System.W ...

  3. System.Web.HttpContext.Current.Server.MapPath("~/upload/SH") 未将对象引用设置为实例对象

    做项目的时候,System.Web.HttpContext.Current.Server.MapPath("~/upload/SH")   获取路径本来这个方法用的好好的 因为需要 ...

  4. System.Web.HttpContext.Current.Session为NULL解决方法

    http://www.cnblogs.com/tianguook/archive/2010/09/27/1836988.html 自定义 HTTP 处理程序,从IHttpHandler继承,在写Sys ...

  5. HttpContext为null new HttpContextWrapper(System.Web.HttpContext.Current)

    HttpContext = (context == null ? new HttpContextWrapper(System.Web.HttpContext.Current) : context);

  6. System.Web.HttpContext.Current.Session获取值出错

    在自定义类库CS文件里使用System.Web.HttpContext.Current.Session获取Session时提示错误:未将对象引用设置到对象的实例. 一般情况下通过这种方式获取Sessi ...

  7. System.Web.HttpContext.Current.Session为NULL值的问题?

    自定义 HTTP 处理程序,从IHttpHandler继承,在写System.Web.HttpContext.Current.Session["Value"]的时 候,没有问题,但 ...

  8. 慎用System.Web.HttpContext.Current

    每当控制流离开页面派生的Web表单上的代码的时候,HttpContext类的静态属性Current可能是有用的. 使用这个属性,我们可以获取当前请求(Request),响应(Response),会话( ...

  9. System.Web.HttpContext.Current 跟踪分析

    public static HttpContext Current { get { return ContextBase.Current as HttpContext; } set { Context ...

随机推荐

  1. New Concept English there (8)

    31w/m 56% The Great St Bernard Pass connects Switzerland to Italy. At 247o metres, it is the highest ...

  2. 源码编译tmux

    (1)clone 源代码仓库: $ git clone https://github.com/tmux/tmux.git (2) 编译之前先安装libevent,去官网下载tar包: http://l ...

  3. flowable IdmEngine和IdmEngineConfiguration

    IdmEngineConfiguration 继承了 AbstractEngineConfiguration. 一.创建EngineConfiguration实例 IdmEngineConfigura ...

  4. 深度学习(六十九)darknet 实现实验 Compressing Deep Neural Networks with Pruning, Trained Quantization and Huffma

    本文主要实验文献文献<Deep Compression: Compressing Deep Neural Networks with Pruning, Trained Quantization ...

  5. oracle对三个列求sum

    oracle数据库对test_table表的三个列count1,count2,count3求sum的两种sql,做个记录 第一种 select sum (case when count1 is not ...

  6. Leetcode 894. All Possible Full Binary Trees

    递归 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # ...

  7. HDU 1043

    http://acm.hdu.edu.cn/showproblem.php?pid=1043 http://www.cnblogs.com/goodness/archive/2010/05/04/17 ...

  8. Zabbix server 3.2安装部署

    zabbix server 前提环境: CentOS 6 Lnmp php需要的包(bcmath,mbstring,sockets,gd,libxml,xmlwriter,xmlreader,ctyp ...

  9. .net collection tips

    1.数组对象都是Array的子类,Array是一个抽象类,不能显示实例化,Array提供了大量操作数组的静态方法 2.ArrayList其实是内部封装了一个array,实现了IList的接口.add ...

  10. 拦截器springmvc防止表单重复提交【3】3秒后自动跳回首页【重点明白如何跳转到各自需要的页面没有实现 但是有思路】

    [1]定义异常类 [重点]:异常类有个多参数的构造函数public CmsException(String s, String... args),可以用来接受多个参数:如(“异常信息”,“几秒跳转”, ...