0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService {

    public WebService () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    [WebMethod]
    public string HelloWorld() {
        return "Hello World";
    }
}

How do I create an example of angularjs using webservice in asp.net?
How do I create a webservice in angularjs?

I have created a simple example of angularjs but how do I create a angularjs Webservice?

2
  • What is this code for? Commented Apr 1, 2015 at 12:36
  • Can you use Web.Api? Commented May 28, 2015 at 14:50

1 Answer 1

1

You can Create a WCF Service and consume it in your AngularJS Application.

  1. Create a WCF Service that returns JSON Data.
  2. Host it on IIS.
  3. Create an AngularJS Application.
  4. Consume the WCF Service in AngularJS Application.

This and this links are simple examples of what you want to do.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.