Windows azure样本执行问题

时间:2015-01-31 10:30:35

标签: c# .net azure mobile service

我正在研究windows azure的移动服务,通过这篇文章http://blogs.msdn.com/b/azuremobile/archive/2014/05/27/how-to-expand-linked-entities-from-mobileservices-client-and-mobileservices-service.aspx

但是当我在本地运行服务时,我得到以下异常

An exception has occurred while using the formatter 'JsonMediaTypeFormatter' to generate sample for media type 'application/json'. Exception message: One or more errors occurred.

enter image description here

1 个答案:

答案 0 :(得分:0)

你可以看到这篇文章

JSON and XML Serialization in ASP.NET Web API

在Azure Mobile Serivce中,您需要在WebApiConfig类中执行

var config = ServiceConfig.Initialize(new ConfigBuilder(options));
config.Formatters.Clear();
config.Formatters.Add(new JsonMediaTypeFormatter());