切换到DNX并升级到Beta4后,只有在发布到服务器时才会出现以下错误。代码在VS中本地运行。我们确保服务器已删除KRE并升级DNX。有什么建议吗?
错误:
InvalidCastException: Unable to cast object of type 'System.Collections.Generic.HashSet`1[System.String]' to type 'System.Collections.Generic.IReadOnlyCollection`1[System.String]'.
Microsoft.AspNet.Mvc.Rendering.DefaultHtmlGenerator.GetCurrentValues(ViewContext viewContext, ModelExplorer modelExplorer, String expression, Boolean allowMultiple)
查看:
@Html.DropDownListFor(m => m.Criteria.Level, Enum.GetNames(typeof(LogManager.Web.Models.EventLevels)).Select(e => new SelectListItem { Text = e, Value = e }), "", new { @class = "form-control" })
project.json
"EntityFramework.SqlServer": "7.0.0-beta4",
"EntityFramework.Commands": "7.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta4",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta4",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.UserSecrets": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"Microsoft.Framework.Logging.Console": "1.0.0-beta4",
"Microsoft.Framework.Caching.Distributed": "1.0.0-beta4",
"Microsoft.AspNet.SignalR.Server": "3.0.0-beta4",
"Microsoft.Framework.Logging.NLog": "1.0.0-beta4"
DNX版本是Beta4。