MVC Web API仅与客户端一起使用? [英] MVC Web API is used with client side only ?

查看:87
本文介绍了MVC Web API仅与客户端一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我只有在asp.net网络表单上工作的经验,但现在想切换学习asp.net mvc。我想问一下关于web API的问题,mvc中的Web API仅由你的javascript代码消耗(单页面应用程序javascript框架,jquery)?我们可以像wcf一样使用它来创建代理,然后在服务器端对象中传递服务器端实体和响应吗?



谢谢

Hi,

I have experience of working on asp.net web forms only but now wants to switch learning asp.net mvc. I want to ask question regarding web API that Web API in mvc is consumed by your javascript code only( single page application javascript frameworks, jquery) ? Can we used it in way we work with wcf like creating proxies and then passing server side entities and response in server side objects ?

Thanks

推荐答案

您可以将WebApi用于任何客户端:JavaScript,Android,iOS,Windows App等。任何可以使用Web服务的平台都将支持Web API。所以是的,可以使用Web API代替WCF。它也更容易设置和使用。



您还可以传递/返回服务器端域对象。默认情况下,WebAPI使用JSON进行序列化和反序列化,但这是可配置的。



这是在Android上使用的WebAPI示例:http://hintdesk.com/how-to-call-asp-net-web-api-service -from-android / [ ^ ]

您可以在此处了解有关WebAPI的更多信息: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api [ ^ ]。
You can use WebApi with any client: JavaScript, Android, iOS, Windows App, etc. Any platform that can consume a web service will support Web API. So yes, Web API can be used in place of WCF. It is also much easier to setup and consume.

You can also pass/return server-side domain objects. By default, WebAPI serializes and deserializes using JSON, but that is configurable.

This is an example of WebAPI being consumed on Android: http://hintdesk.com/how-to-call-asp-net-web-api-service-from-android/[^]
You can learn more about WebAPI here: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api[^].


这篇关于MVC Web API仅与客户端一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆