ANaimi ANaimi -4 years ago 204
ASP.NET (C#) Question

ASP.NET MVC & Web Services

Does adding a Web Service to my ASP.NET MVC project break the whole concept of MVC?

That Web Service (WCF) depends on the Model layer from my MVC project to communicate with the back-end (so it looks to me like it needs to be part of the MVC solution).

Should I add this to the Controller or Model layer?

Answer Source

It sounds like you should split out your model into its own assembly and reference it from your MVC-application and WCF-application.

  • YourApp.Data -- Shared model and data access maybe
  • YourApp.Web -- If you want to share more across your web-apps
  • YourApp.Web.Mvc
  • YourApp.Web.WebService

If you want to do WebServices MVC-style maybe you should use MVC to build your own REST-application.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download