如何调用通过GET一个ASMX web服务? [英] How to call an ASMX web service via GET?

查看:740
本文介绍了如何调用通过GET一个ASMX web服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这里定义一个Web服务:

I have a webservice defined here:

/app/AutocompleteManager.asmx

/app/AutocompleteManager.asmx

[WebMethod]
public string AutocompleteComposers()
{
  return "hey, what's up";
}

我想使用GET方法有额外的参数来调用它。

I want to call it using the GET method with extra parameters.

如果我只是去 /app/AutocompleteManager.asmx?q=something ,它不会工作,因为我指定的动作没有做。

If I just go /app/AutocompleteManager.asmx?q=something, it won't work because I don't have the action specified.

如果我走了 /app/AutocompleteManager.asmx/AutocompleteComposers?q=something 它打破。

任何想法?

推荐答案

更改您的web.config中像这样:

Change your web.config like so:

<system.web>
    ...
    <webServices>
        <protocols>
              <add name="HttpSoap"/> 
              <add name="HttpPost"/>
              <add name="HttpGet"/>
        </protocols>
    </webServices>
</system.web>

这篇关于如何调用通过GET一个ASMX web服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆