asp.net中,后台随机文件名生成时,实际随机数比配置多一位,随机中digit,最小值需要减去1,最大值使用digit本身值。 return rand.Next((int)Math.Pow(10, digit - 1),(int)Math.Pow(10, digit ));