public static void SaveVersionInfo(UpgradeVersions versionInfo) { //读取JSON配置文件 var jsonFile = new FileInfo(HttpContext.Current.Server.MapPath(configSavePath)); jsonFile.Delete(); var jsonStr = JsonConvert.SerializeObject(versionInfo); var jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonStr); var fileReader = jsonFile.OpenWrite(); fileReader.Write(jsonBytes, 0, jsonBytes.Length); fileReader.Flush(); fileReader.Close(); }