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

前端 未结 6 1434
你的背包
你的背包 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:22

    i think there's a couple of things here.

    you can indeed add a web service to an MVC application. you may even consider identifying the web service(s) as a script service to make REST like operations easier to perform via javascript. this may not be necessary due to your circumstances.

    i think there is a stronger question as to the underlying architecture. If you are placing the web service withing your mvc application, because, your database code is already there...should it be? it might be a good time to abstract your data layer out a little. However, if you're dealing with a relatively small project and don't need the flexibilty, then certainly, add a web service right in. i guess what it really boils down to is addressing the true needs of your application.

提交回复
热议问题