简体   繁体   English

无法调用我的Web服务asp.net MVC

[英]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. 当我在本地尝试时,它可以工作,但是当我发布并上传到binero时,什么也没发生。 I believe that it dosen't know where to look for the web service even tho Ive added it to the ftp. 我相信即使我将其添加到ftp中,它也不知道在哪里寻找Web服务。

here is my index.aspx 这是我的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 这是我的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

http://www.ebrandstedt.se/webservice1.asmx <-- There can you find the webservice http://www.ebrandstedt.se/webservice1.asmx <-您可以找到该Web服务

All help is appreciated. 感谢所有帮助。

/MVH Emil / MVH Emil

Found my answear here, needed to add alot in my web.config to enable ajax. 在这里找到我的answear,需要在我的web.config中添加很多以启用ajax。 Very nice guide! 很好的指导!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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