zoukankan      html  css  js  c++  java
  • 异常处理方式

    C# 异常

    异常情景

     错误提示

    2020-02-26 14:43:55,528 线程ID: [47] 耗时:[611] ERROR>> [出错类:PassTrain.BLL.Train_BLL;出错消息:Aitest_Review_PushMarkResultByReviewClouds]
    System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
       at PassTrain.Exercise.ReviewSocket_Basic.SendReviewData(String JsonData, String UserId)
       at PassTrain.BLL.Train_BLL.Aitest_Review_PushMarkResultByReviewClouds(Object info)

    出现错误情况

    字典一旦赋了键值便不能够在循环里面进行修改/删除等操作,只能获取

    解决方法

    可以将foreach循环修改改为for循环

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    异常情景:

    错误提示:

    2020-02-26 18:44:54,993 线程ID: [8] 耗时:[70] ERROR>> 开启日志文件的配置时异常==>
    System.NullReferenceException: Object reference not set to an instance of an object.
       at PassTrain.Helper.LogHelper.setlogEnable()

    出现错误情况:

    未做空处理

    解决方法:

    如上图

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    IIS异常

    AddBy 2020-12-23

     无法读取json文件(web.config配置文件异常),解决案例:https://blog.csdn.net/yinsefeixingchuan/article/details/107444511

    Web.config文件进行相关配置

     <system.webServer>
        <staticContent>
          <remove fileExtension=".json" />
          <mimeMap fileExtension=".json" mimeType="application/json" />
          <mimeMap fileExtension=".mrt" mimeType="application/json" />
        </staticContent>
    
      </system.webServer>

    EndBy 2020-12-23

    异常情景:

    错误提示:

    出现错误情况:

    解决方法:

  • 相关阅读:
    继承
    反射
    DOS使用笔记
    [LeetCode] Merge Intervals
    [LeetCode] Insert Interval
    [LeetCode] Permutation Sequence
    [LeetCode] Rotate List
    [LeetCode] Text Justification
    [LeetCode] Simplify Path(可以不用看)
    [LeetCode] Edit Distance(很好的DP)
  • 原文地址:https://www.cnblogs.com/namejr/p/12367237.html
Copyright © 2011-2022 走看看