启用ASP.NET ASMX Web服务的HTTP POST / GET请求 [英] Enable ASP.NET ASMX web service for HTTP POST / GET requests

查看:2452
本文介绍了启用ASP.NET ASMX Web服务的HTTP POST / GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想启用HTTP POST一个ASP.NET经典(ASMX)Web服务和GET请求。我知道这可以在一台机器或应用程序级加做...

I would like to enable a ASP.NET classic (ASMX) web service for HTTP POST and GET requests. I realise this can be done on a machine or application level by adding ...

<webServices>
    <protocols>
        <add name="HttpGet"/>
        <add name="HttpPost"/>
    </protocols>
</webServices>

。要在machine.config或web.config中。我的问题是可以HTTP POST和GET请求每个Web服务或Web方法,而不是每个应用程序或机器被启用?

.. to the machine.config or web.config. My question is can HTTP POST and GET requests be enabled per web service or web method level rather than per application or machine?

我的Web服务使用3.5SP1净用C#编写。

My web service is written in c# using net 3.5sp1.

推荐答案

尝试在你的方法来声明UseHttpGet。

Try to declare UseHttpGet over your method.

[ScriptMethod(UseHttpGet = true)]
public string HelloWorld()
{
    return "Hello World";
}

这篇关于启用ASP.NET ASMX Web服务的HTTP POST / GET请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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