无法访问服务类中的类? [英] Unable to access class inside the service class?

查看:61
本文介绍了无法访问服务类中的类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了如下服务类



  public   class 服务:System.Web.Services.WebService 
{
public void samplemeth()
{
...........
.......... 。
}
}

public enum 结果{ 0 1 }

public class 示例
{
............
... .........
}





i添加了对服务的引用,但我的问题是我能够访问Service类和结果枚举,但我无法访问Sample类。



请给我一个解决方案如何访问此服务中的类

解决方案

 [WebMethod(Description =  这是我的Sample类 )] 
public class 示例
{
............
............
}



相当肯定你需要添加webmethod声明。

  //  返回json for jquery等 
[WebMethod(Description = 这是我的Sample类)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public class 示例
{
............
............
}


I have created the service class as follows

public class Service : System.Web.Services.WebService
{
public void samplemeth()
{
...........
...........
}
}

public enum result{ 0, 1 }

public class Sample
{
............
............
}



i added the reference to the service but my problem is i am able to access the Service class and result enum but i am unable to access the Sample class.

Please give me a solution how can i access the class inside this service

解决方案

[WebMethod(Description = "This is my Sample class")]
 public class Sample
{
............
............
}


Pretty certain you need to add the webmethod declarations.

//to return json for jquery etc.
 [WebMethod(Description = "This is my Sample class")]
 [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public class Sample
{
............
............
}


这篇关于无法访问服务类中的类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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