可一个asp.net MVC应用程序也有一个Web服务? [英] Can an asp.net mvc application also have a web service?

查看:108
本文介绍了可一个asp.net MVC应用程序也有一个Web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net MVC应用程序,现在我需要添加一个Web服务与它一起去。什么是我们的最佳解决方案?只要创建一个新的Web服务项目,并使用不同的URL将其添加到我的解决方案,然后将其部署到同一个Web服务器?我想它是只是因为我有我的所有数据库code在那里MVC应用程序的一部分。

I have an asp.net mvc application and now I need to add a web service to go along with it. What is the best solution for this? Just create a new web service project and add it to my solution then deploy it to the same web server using a different url? I would like it to be a part of the mvc application only because I have all my database code in there.

任何建议将是AP preciated。谢谢你。

Any suggestions would be appreciated. Thanks.

推荐答案

有没有理由不添加Web服务项目。

There's no reason not to add a web service project.

您说,所有数据库code是在你的MVC项目。我强烈建议你从那里删除它到一个单独的类库项目。这第三个项目将通过Web服务并通过MVC应用程序均可使用。

You state that all your database code is in your MVC project. I strongly recommend you remove it from there into a separate class library project. This third project would be used both by the web service and by the MVC application.

我也强烈建议您不要任何新的开发使用ASMX Web服务。

I also strongly recommend that you not use ASMX web services for any new development.

使用WCF的,除非你没有选择可言。有一种误解,认为WCF服务不做SOAP - 他们做的,WCF已经取代ASMX

Use WCF only, unless you have no choice at all. There's a misconception that WCF services don't do SOAP - they do, and WCF has replaced ASMX.

这篇关于可一个asp.net MVC应用程序也有一个Web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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