Summon WCF that is in another Class Library from JQuery

0

Hi, I have a problem trying to call a Wcf that is in a Class Library, I try it with JQuery making the necessary modifications, I've tried some relative and absolute paths in the Ajax URL, I'm doing it with a simple example annex the image. I already made modifications in the WEb.Config I want to consume from the js file that is inside the js folder, the WCF is in the class library that is below the Grafica.svc flame Thank you in advance for your help.

    
asked by jhovanny gonzalez 16.04.2018 в 23:36
source

1 answer

0

The first thing you should validate is if this service WCF responds correctly, for that take the url and browse it from browser , you should be able to see the default page that the .svc shows, otherwise you can see that page then the service is not listening request.

I do not know how you are invoking from the client by means of ajax, but if valid

Calling WCF Services Using jQuery

You'll see what he uses

$.ajax({  
   type: "POST",  
   contentType: "application/json; charset=utf-8",  
   url: 'Service.svc/GetData',  
   success: function (data) { ...

basically as defined by the url, in this case the site and the service are in the same web project, but you should define the complete url, such as:

http://<NombrePC o IP>:puerto/servicio.svc

since the client and the service are on different hosts

    
answered by 17.04.2018 / 06:07
source