作者:我是王美慧 | 来源:互联网 | 2023-06-07 10:36
临时用c#写一个项目,使用asmx实现webservice。代码如下:12345678910 [WebMethod] public void AddGroup(String app_key
临时用c#写一个项目,使用asmx实现webservice。代码如下:
1 2 3 4 5 6 7 8 9 10
| [WebMethod]
public void AddGroup(String app_key, String app_secret, String group_name)
{
String res = addGroup.add(app_key, app_secret, group_name);
Context.Response.Charset = "UTF-8";
Context.Response.COntentEncoding= System.Text.Encoding.GetEncoding("UTF-8");
Context.Response.Write(res);
Context.Response.End();
} |
需要实现group_name字段参数可以选择是否传入,现在如果不传入group_name的话C#会自动返回参数不全。如下:
1 2 3 4
| System.InvalidOperationException: 缺少参数: finger_print_base64。
在 System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
在 System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() |