加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 无法让Web API在VS 2010或2012中运行

发布时间:2020-12-16 03:21:58 所属栏目:asp.Net 来源:网络整理
导读:我有一台装有VS 2012的VS和VS2010的机器.我试图按照 http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api上的代码来试用Web API.我尝试在网上关注如何解决问题的一些不同的链接,但仍然无法使用IIS Expres
我有一台装有VS 2012的VS和VS2010的机器.我试图按照 http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api上的代码来试用Web API.我尝试在网上关注如何解决问题的一些不同的链接,但仍然无法使用IIS Express / Cassini为我的Windows 7 x64机箱上的主机使用Web API.目前我得到“未找到方法:’Void Newtonsoft.Json.Serialization.DefaultContractResolver.set_IgnoreSerializableAttribute(Boolean)’.”尝试查看应该是什么产品列表时出错.

我完全按照编写的方式跟踪网页,并且没有手动添加任何内容.我确实为网络堆栈http://www.myget.org/F/aspnetwebstacknightly/设置了夜间存储库,但不知道是否导致问题.如果有帮助的话,这是NuGet的Get-Package转储程序.

PM> Get-Package

Id                             Version              Description/Release Notes                                                                                                                                                                                      
--                             -------              -------------------------                                                                                                                                                                                      
EntityFramework                5.0.0-rc             Entity Framework is Microsoft's recommended data access technology for new applications.                                                                                                                       
jQuery                         1.6.2                jQuery is a new kind of JavaScript Library....                                                                                                                                                                 
jQuery.UI.Combined             1.8.11               jQuery UI is an open source library of interface components — interactions,full-featured widgets,and animation effects — based on the stellar jQuery javascript library . Each component is built accordin...
jQuery.Validation              1.8.1                This jQuery plugin makes simple clientside form validation trivial,while offering lots of option for customization. That makes a good choice if you’re building something new from scratch,but also when y...
knockoutjs                     2.0.0                A JavaScript MVVM library to help you create rich,dynamic user interfaces with clean maintainable code                                                                                                        
Microsoft.AspNet.Mvc           4.0.20505.0          This package contains the runtime assemblies for ASP.NET MVC. ASP.NET MVC gives you a powerful,patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you ...
Microsoft.AspNet.Providers.... 1.0                  ASP.NET Universal Providers add provider support in ASP.NET 4 for all editions of SQL Server 2005 and later and to SQL Azure. If you use these providers to develop your application,the application will b...
Microsoft.AspNet.Providers.... 1.0                  ASP.NET Universal Providers add provider support in ASP.NET 4 for all editions of SQL Server 2005 and later and to SQL Azure. If you use these providers to develop your application,the application will b...
Microsoft.AspNet.Razor         2.0.20505.0          This package contains the runtime assemblies for ASP.NET Web Pages. ASP.NET Web Pages and the new Razor syntax provide a fast,terse,clean and lightweight way to combine server code with HTML to create d...
Microsoft.AspNet.Web.Optimi... 1.0.0-beta2          ASP.NET Optimization introduces a way to bundle and optimize css/js files.                                                                                                                                     
Microsoft.AspNet.WebApi        4.0.20505.0          This package contains everything you need to host ASP.NET Web API on IIS. ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients,including browsers a...
Microsoft.AspNet.WebApi.Client 4.0.20505.0          This package adds support for formatting and content negotiation to System.Net.Http. It includes support for JSON,XML,and form URL encoded data.                                                             
Microsoft.AspNet.WebApi.Core   4.0.20505.0          This package contains the core runtime assemblies for ASP.NET Web API. This package is used by hosts of the ASP.NET Web API runtime. To host a Web API in IIS use the Microsoft.AspNet.WebApi.WebHost packag...
Microsoft.AspNet.WebApi.Web... 4.0.20505.0          This package contains everything you need to host ASP.NET Web API on IIS. ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients,including browsers a...
Microsoft.AspNet.WebPages      2.0.20505.0          This package contains core runtime assemblies shared between ASP.NET MVC and ASP.NET Web Pages.                                                                                                                
Microsoft.jQuery.Unobtrusiv... 2.0.20505.0          jQuery plugin that lets you unobtrusively set up jQuery Ajax.                                                                                                                                                  
Microsoft.jQuery.Unobtrusiv... 2.0.20505.0          jQuery plugin that unobtrusively sets up jQuery.Validation.                                                                                                                                                    
Microsoft.Net.Http             2.0.20505.0          This package provides a programming interface for modern HTTP applications. This package includes HttpClient for sending requests over HTTP,as well as HttpRequestMessage and HttpResponseMessage for proce...
Microsoft.Web.Infrastructure   1.0.0.0              This package contains the Microsoft.Web.Infrastructure assembly that lets you dynamically register HTTP modules at run time.                                                                                   
Modernizr                      2.0.6                Modernizr adds classes to the <html> element which allow you to target specific browser functionality in your stylesheet. You don't actually need to write any Javascript to use it....                        
Newtonsoft.Json                4.5.1                Json.NET is a popular high-performance JSON framework for .NET                                                                                                                                                 
WebGrease                      1.0.0                Web Grease is a suite of tools for optimizing javascript,css files and images.

解决方法

我打开了NuGet的“Include Prerelease”,并将所有软件包更新到最新的每晚版本.它修复了VS 2012中的问题.虽然不知道VS2010.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读