简体   繁体   中英

referencing a WCF web service

Our current project uses an asmx service. We want to keep this service for now, but would like to add an additional wcf service for ajax calls.

I followed a procedure i found online to set up the service and it works fine with javascript in aspx files within that particular project but i'm unsure how to reference it in javascript files in a different project (in the same solution).

If someone could point me in the right direction it would be much appreciated.

Thanks,
Shawn

EDIT: i wish to make calls in javascript similar to the following:

   function Button1_onclick() {
    var service = new AjaxServices.TestService();
    service.wcfTest(4, onSuccess, null, null);
}

function onSuccess(result){

    document.getElementById("ajaxPlaceHolder").innerHTML = "<p>" + result + "</p>";
}

// ]]>

but i'm willing to explore the jQuery option as well.

Are you hosting your webapps in IIS?

What OS/IIS version?

How are you making your ajax calls (jquery/asp.net web extensions/other)

If it's a seperate webapp which will run as it's own website, ie, not another virtual directory, then you'll probably need to set the URI in code somewhere. Possibly a web.config appsetting that gets red in a can be written out into a page level js variable using the ClientScript.RegisterStartupScript method.

More info would help.

Matt

如果将ASP.Net MVC用于json服务,则可以按以下链接中所示进行操作: http : //nayyeri.net/using-jsonresult-in-asp-net-mvc-ajax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM