什么WCF WebHttp做ASP.NET MVC不能? [英] What can WCF WebHttp do that ASP.NET MVC cannot?

查看:146
本文介绍了什么WCF WebHttp做ASP.NET MVC不能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请,没有他们解决了2个不同的问题的答案,这是相同的 HTTP请求和响应的问题。仅仅因为你有意见/ MVC中的模板并不意味着你必须使用它们。 M_C是服务于XML和JSON足够好了。

Please, no "They solve 2 different problems" answers, it's the same HTTP request and response problem. Just because you have views/templates in MVC doesn't mean you have to use them. M_C is good enough for serving XML and JSON.

请,没有这就是微软说你应该做的答案。如果我是这样想的,我不会问这个问题。


显然,人们不喜欢我怎么措辞我的问题,但标题是很清楚的。我想了解WebHttp可以做什么MVC不能,或者是两者都可以做,但与WebHttp更容易或更强大。
我真的很了解详细信息,如果选择一个比其他的不是高层次的描述。

Please, no "It's what Microsoft says you should do" answers. If I thought that way I wouldn't be asking this question.


Apparently people did not like how I phrased my question, but the title is very clear. I'd like to learn what WebHttp can do that MVC can't, or what both can do but with WebHttp it's easier or more powerful.
I'm really looking for details, not a high level description of when to choose one over the other.

推荐答案

目前在MVC应用程序有更多的开销。因为你真的不需要URL重写提供其他服务时(而不是搜索引擎优化大小写),或者不需要谷歌机器人来了解什么是重要的,你并不需要的 - 所以路由开销是不必要的。

There is a lot more overhead in an MVC application. Since you don't really "need" Url-rewriting when serving other services (not SEO-sensitive), or don't need Google robots to understand what's important, you don't need that - and so the routing overhead is unnecessary.

所需的核心功能的MVC的ASP.NET MVC组件包含视图特定方法,使它们更大。如果你唯一的目的是为JSON / XML是没有必要的扩展方法来创建文本框,复选框等。

The ASP.NET MVC assemblies needed for the core MVC functionality contains view-specific methods, causing them to be larger. If your only purpose is to serve JSON/XML there is no need for extension methods for creating textboxes, checkboxes etc.

这也将是一个更容易的任务来完成单元测试WCF服务,因为你不需要理会模拟控制器,模拟情境等。(给定的JSON响应为你提供的唯一的事)

It would also be an easier task to do unit tests for a WCF service, since you you don't need to bother with mock controllers, mock contexts etc.. (given JSON-response is the only thing you're providing)

所以,底线 - 这是不需要使用ASP.NET MVC的服务只JSON数据,除非你想提供某种图形用户界面的结合JSON数据的comsumer

So bottom line - it's unnecessary to use ASP.NET MVC for serving only JSON-data unless you want to provide the comsumer with some kind of GUI in combination with the JSON data.

一首字母缩写词浮现在脑海:KISS。 :)

One acronym comes to mind: KISS. :)

这篇关于什么WCF WebHttp做ASP.NET MVC不能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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