Can an asp.net mvc application also have a web service?

前端 未结 6 1425
你的背包
你的背包 2021-02-09 06:42

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

6条回答
  •  情歌与酒
    2021-02-09 07:35

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

    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.

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

    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.

提交回复
热议问题