Reputation: 53
How to build a .net web service to communicate with a remote server (different domain) using javascript. It's better soap or rest? What HEADERS must be defined so that my server accect to recover the data. Like this web service that I believe made the already well https://api.github.com/users/peterbe/gists
Upvotes: 0
Views: 301
Reputation: 53
I found! I did a Web service with web api and:
Install-Package Microsoft.AspNet.WebApi.Cors//In Nu get
config.EnableCors();//In WebApiConfig Register
[EnableCors(origins: "*", headers: "*", methods: "*")]//Above of Controller class
It's work
Upvotes: 0
Reputation: 102
Just to be sure: You want to build a webservice with .net and build a client JavaScript, right.
For building a webservice in .net have look at a framework. IMHO these helps a lot.
ASP.NET Web API or Servicestack to start with.
For client, search for: "javascript consuming web service" you will find a lot of samples.
Upvotes: 1