开发者

Can't call my web service asp.net mvc

开发者 https://www.devze.com 2023-03-04 03:48 出处:网络
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

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/开发者_如何学Gojavascript">

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

0

精彩评论

暂无评论...
验证码 换一张
取 消