关于 error: Operation is not valid due to the current state of the object。

今天碰到一个特别的异常。

Operation is not valid due to the current state of the object.

at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()

后来发现,客服端post过来的参数,传过来一大堆不用的,但感觉也不应该会抛异常啊。

后来把参数纠正后(减少了很多post过来的参数),就正确了。

但不甘心,又网上搜索了下,查到如下解决方法:

 <configuration>
  <appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="5000" />
  </appSettings>
</configuration>

 

开来FillInFormCollection,是有个数限制的。以后得多多注意。

转载于:https://www.cnblogs.com/Denny_Yang/p/4962843.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ERROR: Could not install packages due to an OSError: [WinError 32] is a common error message that occurs when there is a problem with installing packages on a Windows operating system. This error is usually caused by a file or process being locked by another program, preventing the installation process from accessing it. To resolve this issue, you can try the following solutions: 1. Close other programs: Make sure that no other programs are using the files or processes that the installation process requires. Close any unnecessary programs and try installing the packages again. 2. Restart your computer: Sometimes, a simple restart can resolve the issue by releasing any locked files or processes. After restarting, try installing the packages again. 3. Run the installation as an administrator: Right-click on the installation file or command prompt and select "Run as administrator". This will give the installation process the necessary permissions to access and modify files. 4. Disable antivirus software: Antivirus software can sometimes interfere with the installation process. Temporarily disable your antivirus software and try installing the packages again. Remember to re-enable it once the installation is complete. 5. Use a virtual environment: Create a virtual environment for your project and install the packages within that environment. This can help isolate any conflicts with other installed packages or system configurations. If none of these solutions work, you may need to provide more specific details about the packages you are trying to install and the steps you have taken so far.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值