Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asp.Net MVC and Web Services

I have an existing Asp.Net MVC Website and I would also like to provide a Web Service from the same domain.

What is the best way to approach creating a web service in this scenerio?

Do I add to this project or...?

like image 251
Nicholas Murray Avatar asked Oct 18 '10 11:10

Nicholas Murray


People also ask

What is Web services in ASP.NET MVC?

ASP.NET MVC 5 for Beginners A web service is a web-based functionality accessed using the protocols of the web to be used by the web applications. There are three aspects of web service development: Creating the web service. Creating a proxy. Consuming the web service.

What is the difference between ASP.NET MVC and Web API?

Asp.Net MVC is used to create web applications that return both views and data but Asp.Net Web API is used to create full-blown HTTP services with an easy and simple way that returns only data, not view.

Is ASP.NET a web service?

ASP.NET enables you to create custom Web services or to use built-in application services, and to call these services from any client application. Basically web service is any piece of software that makes itself available over the Internet and uses a standardized XML messaging system.


1 Answers

You should be able to add an WebService file directly to the MVC project. Right click on solution and select add new item, then select the web category and att the bottom of the list there should be Web Service.

Just remember to check that the routes does not eat up the call to the webservice.

That way the webservice can get access to the same model classes as the MVC application.

like image 151
David Mårtensson Avatar answered Oct 22 '22 08:10

David Mårtensson