Hi All,
I am having issue in calling asp.net web service from javascript. The web service resides in one of our development machine and i am trying to call the web service from my local machine. (The application works fine if the webservice resides in my local machine) The reference for webservice is added to Scriptmanager. ScriptManager1.Services.Add(new ServiceReference("http://xxx.xxx.xx.xx/MyService/Service.asmx"); I debugged the code.. The scriptmanager takes the correct webservice reference. The client proxy files (jsdebug) are also generating correctly. But when i call the webservice it seems to take localhost as the root instead of the development machine ip (noticed using firebug). Please help me to solve this issue

Thanks

What if:
1. you first create the follwing in the web.config file

<appSettings>
    <add key="servicePath" value="http://yourmachin/MyService/Service.asmx"/>
  </appSettings>

2. Then you add using System.Configuration; in the source file
3. in the page load method:

protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager1.Services.Add(new ServiceReference(ConfigurationManager.AppSettings["servicePath"].ToString()));
        }

Will this help?

/Frank

Hi Frank,
I am also doing the same procedure. While debugging i can see that the ScriptManager takes the correct webservice path as in the webconfig file. The scriptmanager also creates the client proxy files correctly. But once the page gets loaded in the browser the web service URL is changed back to localhost instead of the development machine URL ("http://xxx.xxx.xx.xx/.....") . I can also see that the URL is correctly redendered in the source file.

Thanks

Hi,
I was already setting the ScriptService enabled webservice path in web.config and adding a new scriptreference to the ScriptManager, just like Frank mentions.. When I build my website and then run I am able to get results. But my issue is I want to be able to debug as well at least in my development environment on my machine through ASP.Net solution. Hence when I try to debug I see in the AJAX generated code, when it is trying to invoke the result of this._get_path() has only virtual directory onwards (not the localhost/... ) and when I in the QuickWatch window try to reset it to be with the whole http://localhost/myvirtualdir... it gives me access denied when I try to execute right after resetting the path. It is a pain not to be able to debug from the client side. I have to have a test button to call the webservice on the server side to make sure I get the results and then put the call on the client side and build the website to see the results, that is what it is amounting to right now. Totally frustrating. Any help is appreciated.

... LotusShiv

This article has been dead for over six months. Start a new discussion instead.