目前的情况:一个ASP.NET MVC的网站有多个控制器和行动方法和观点,从而允许将食谱
current situation: an ASP.NET MVC web site with a number of controllers and action methods, and views to allow adding recipes.
现在,我要创建一个WPF应用程序充当UI添加配方(相同的网站)。
Now, I have to create a WPF application that acts as a UI to add recipes (same as the web site).
我的问题是:我可以使用ASP.NET MVC网站揭露了由WPF应用程序消耗的服务操作(以及如何才能做到这一点)?或者我应该更好地创造为专用WCF服务,并有WPF和ASP.NET MVC的网站使用这些服务?
My question is: can I use ASP.NET MVC site to expose service operations that are consumed by the WPF application (and how can this be done)? Or should I better create dedicated WCF services for that, and have the WPF AND the ASP.NET MVC site consume these services?
谢谢,路德维希
Thanks, Ludwig
推荐答案我已经成功地使用MVC控制器和行动服务从浏览器中以HTML的意见,以及外部应用程序。它的工作原理很好,但因为它代表你需要的工具一点点:
I have successfully used MVC controllers and actions to service both HTML views from the browser, as well as external applications. It works well, but as it stands you'd need a little bit of tooling:
但是,你可以避开一些这种额外的工具,如果你去了WCF-REST路线。更重要的是,我想看看ASP.NET MVC 4的功能的WebAPI(这是我将迁移到)。
However, you could avoid some of this extra tooling if you go the WCF-REST route. Better yet, I'd look into ASP.NET MVC 4's WebApi feature (which is what I will be migrating to).
有关的记录,我认为WCF是强大的,但我们的组织已经厌倦的是多么复杂,把所有的旋钮和打所有的交换机以获得工作的权利,并设置方便地从一个安装到其他。 MVC,在另一方面,只是工作......因为我们已经用它来服务我们的HTML视图,它是一个真正的喜悦,只需要添加一些额外的code把它处理服务电话,太。只是个人的preference,当然了。
For the record, I think WCF is powerful, but our organization has grown tired of how complicated it can be to turn all the knobs and hit all the switches to get it working right, and set up easily from one install to the other. MVC, on the other hand, just works... and since we already use it to service our HTML views, it's a real joy to only have to add a little extra code to have it handle service calls, too. Just a personal preference, of course.
更多推荐
消费ASP.NET MVC的操作方法
发布评论