Ich habe einen Beispielcode für Webapi heruntergeladen und ich bekomme diese Ausnahme Ich öffnete dieses Beispiel mit Visual Studio 2012 Ultimate Version und ich habe die neueste Version von newtonsoft installiert.Ich bekomme diesen Fehler, wenn ich diese Anwendung.Ist erfolgreich kompilieren. Irgendeine Idee, warum dieser Fehler und gibt es eine Möglichkeit, diese Ausnahme zu beheben.Methode nicht gefunden 'Leere Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute (Boolean)
System.MissingMethodException was unhandled by user code
HResult=-2146233069
Message=Method not found: 'Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)'.
Source=System.Net.Http.Formatting
StackTrace:
at System.Net.Http.Formatting.JsonContractResolver..ctor(MediaTypeFormatter formatter)
at System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor()
at System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters()
at System.Net.Http.Formatting.MediaTypeFormatterCollection..ctor()
at System.Web.Http.HttpConfiguration.DefaultFormatters()
at System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes)
at System.Web.Http.GlobalConfiguration.<.cctor>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at System.Web.Http.GlobalConfiguration.get_Configuration()
at System.Web.Http.RouteCollectionExtensions.MapHttpRoute(RouteCollection routes, String name, String routeTemplate, Object defaults, Object constraints, HttpMessageHandler handler)
at System.Web.Http.RouteCollectionExtensions.MapHttpRoute(RouteCollection routes, String name, String routeTemplate, Object defaults)
at WebAPIRc.RouteConfig.RegisterRoutes(RouteCollection routes) in c:\Users\viemon\Downloads\WebAPIRc\WebAPIRc\WebAPIRc\App_Start\RouteConfig.cs:line 17
at WebAPIRc.WebApiApplication.Application_Start() in c:\Users\viemon\Downloads\WebAPIRc\WebAPIRc\WebAPIRc\Global.asax.cs:line 36
InnerException:
Hier ist der Code, wo es
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//Exception error start
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
//exception error end
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
ich, dass ich auf „Include Prerelease“ from this post, aber wie kann ich drehen, wie man einschalten für NuGet kam zu wissen, nicht drehen müssen das "Prerelease einbeziehen" für NuGet?
Bauen gesetzt Kannst du mehr Details dazu sagen? –
Hey, ich denke, ich hatte eine Version in meinem .NET4 Gac, die hier zu finden ist http://StackOverflow.com/Questions/6925043/where-is-gacutil-for-net-framework -4-0-in-windows-7 und ich musste das entfernen, so dass die Laufzeit die neuere Version https://msdn.microsoft.com/en-us/library/zykhfde0 (v = vs.110) abholen würde) .aspx Ich weiß nicht, warum diese Version ursprünglich in meinem GAC war. Hoffe, dass hilft – PatrickWalker