简体   繁体   中英

Can't call my web service asp.net mvc

Im having trouble with calling my web service. When I try it localy It's working but when I publish it and upload to binero nothing happends. I believe that it dosen't know where to look for the web service even tho Ive added it to the ftp.

here is my index.aspx

<script language="javascript" type="text/javascript">

function pageLoad() {

    test();
}

function test() {

    MvcApplication8.WebService1.HelloWorld(callback);
}

function callback(result) {

    alert(result);

}

<h2>Index</h2>

  <form runat="server">
<asp:ScriptManager runat="server" ID="scriptservice">
<Services>
<asp:ServiceReference Path="../../WebService1.asmx" />
</Services>
</asp:ScriptManager>
</form>

Here is my webservice.asmx

namespace MvcApplication8
{

[WebService(Namespace = "http://ebrandstedt.se/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{

    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}

}

It's published at http://www.ebrandstedt.se

http://www.ebrandstedt.se/webservice1.asmx <-- There can you find the webservice

All help is appreciated.

/MVH Emil

Found my answear here, needed to add alot in my web.config to enable ajax. Very nice guide!

http://www.asp.net/ajax/videos/how-do-i-aspnet-ajax-enable-an-existing-web-service

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