开发者

How to host a web service in MVC3?

How can 开发者_开发技巧I use a web service in mvc3? Where should I include the web service? Completely new to that...Help please.


In latest versions of VS you can click here:

How to host a web service in MVC3?

In opened window you will be able to enter service address and do required configuration.

You can place your service references in any project. Id suggest to create a separate project and hold them there.


They made it hard to find the add Web Reference functions in later versions of VS, seeming to try and make us use fully blown WCF hosted services instead... But you can still do it.

Right click on the Service References folder and click on Add a new Reference then click on Advanced and then there is another button to add a Web Service in that window.


I help maintain the Open Source ServiceStack web services framework that has a NuGet MVC PowerPack letting you trivially add Web Service Functionality to any MVC web application.

Out of the box, without any config or code-gen, ServiceStack automatically provides REST XML, JSON, JSV, CSV and SOAP web services. Here are a couple live demos that show you how to easily create web services with just C# (and no Config):

  1. Hello World Tutorial
  2. Northwind Database Web Services
  3. GitHub-like REST files explorer

Edit added MV3 + ServiceStack Demo

The SocialBootstrapApi Demo project is a functional MVC3 + ServiceStack + Twitter Bootstrap + Backbone SPA website which also has a live copy of the repo deployed on AppHarbor at: http://bootstrapapi.apphb.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜