我的代码如下:
public class Service : System.Web.Services.WebService
{
public Service () {
}
public class event_t
{
public string place;
public int day;
public event_t()
{
}
}
[WebMethod]
event_t getEvent(string sms)
{
event_t tmp = new event_t();
tmp.place = sms;
tmp.day = 1;
return tmp;
}
Run Code Online (Sandbox Code Playgroud)
}
我的问题是:为什么运行它时getEvent Web方法是不可见的?根据MSDN,http://msdn.microsoft.com/en-us/library/3003scdt( v = vs.71).aspx 它应该工作.
我很确定你的getEvent方法需要公开.
[WebMethod]
public event_t getEvent(string sms)
{
event_t tmp = new event_t();
tmp.place = sms;
tmp.day = 1;
return tmp;
}
Run Code Online (Sandbox Code Playgroud)