What is the difference between a web service in the same project and a different project in the same solution?

3

Everyone tells me to create a REST and not SOAP. I know I'm just going to get it right.

I took an old project in the company where I am with a web service in the same project.

As I'm using MVC, I created a web service and I came across two situations: or I start a new web site ); or I add a new WCF and create a web service (WCF) in the same project.

I confess that I can not distinguish this difference well, if it exists. What should I really do? Is there a right or more advantageous way to use one approach over another?

    
asked by anonymous 28.04.2014 / 15:38

3 answers

2

Do the following:

  • Create a Class Library project for your business
  • Create an MVC 4 or 5 project for your Site
  • Create an MVC / WebAPI project for your REST WebService
  • In your Website and Web Service project refer to your Business Project (1)
  • 28.04.2014 / 15:47
    2

    If you are going to create REST services, I strongly recommend using WebAPI . The concepts are similar to those of ASP.NET MVC, having controllers and actions ... and therefore it is easier to reuse your knowledge.

    You can create in the same project, you do not need to start a new project, unless for organization reasons.

        
    28.04.2014 / 15:47
    0

    You could create this REST service using WCF or WebAPI , both have their peculiarities.

    But an interesting question is also about publishing:

    Creating a new project separate from your Asp.Net MVC project, every time your Asp.Net MVC project and its REST service changes and you need to update them in the production environment, you need to publish each one. Updating two projects.

    Already creating the REST service in your Asp.Net MVC project, every time you publish your application, you do not need to publish your REST service as well. Updating only the Asp.net MVC project.

        
    29.05.2014 / 15:42