Just want to add a bit more on my previous comment. See if the url is something like a relative path (~/api/) instead of a fixed path like "http://localhost:64189/api/". So when you publish it to www.example.com. Then the path will be www.example.com/api/, But it is fixed path. Will my file on www.example.com be able to access the service on http://localhost:64189/api/?
Thank you. Yes localhost is just a different name for the ip address. So look at this code:
client.BaseAddress = new Uri("http://localhost:64189/api/");
Will this still work when you publish it on the hosting provider since the url is localhost? Or another way to put it, will the web api service still accessible through the url above?
Also when you add service reference, here is how you called the WCF service
ServiceReference.Service1Client age = new ServiceReference.Service1Client();
day = int.Parse(TextBox1.Text);
Month = int.Parse(TextBox2.Text);
Year = int.Parse(TextBox3.Text);
//assigning the output value from service Response
TotalDays = age.calculateDays(day, Month, Year);
I would like to be able to call it using client script such as jquery or angularjs. So how can you actually consume it using jquery or javascript. Thanks.
IThank you for your reply and yes at this moment I am open to any options. Now about Web api. Does that mean I need to host the api service itself on a separate domain or sub domain? Or can it be part of web application? If I can, I just want it to be part of web application. So no set up another sub domain and easier to maintain. I just need to publish my site once and it's done.
Again thank you.
Thank you. My web application is in asp.net. I use angularjs to call asmx web service. But now I would like to use angularjs to call .svc wcf service. Any idea how it is done? So here is how I called .asmx web service:
service.create = function (name) {
return $http.post(
'/service/simpleService.asmx/createUser',
{ "name": name }
);
};
Ehe problem here is how I could replace this with something like this if possible at all:
service.create = function (name) {
return $http.post(
**'/service/wcfService.svc/createUser',**
{ "name": name }
);
};
I tried but it did not work.
Thank you for your comment. I checked online. Azure is just too expensive. It charges by hours and not annually. If I calculated the fee corrected, it is 3000 USD a year.