class在wcf服务类中不起作用

时间:2014-05-08 11:01:05

标签: asp.net wcf

公共类在wcf服务中不起作用。我创建了另一个公共类并使用到我的service.svc但是类无法访问。请参阅以下代码。

ITest.cs

namespace TestProject.Services
{
  [ServiceContract]
  public interface ITest
  {
    [ServiceContract]
    public interface ITest
    {
        [OperationContract]
        DataTable SelectData(string sSectionName);
    }
 }
 }

ITest.svc.cs

 namespace TestProject.Services
 {
   public class Test: ITest
    {
      public DataTable SelectData(string sSectionName)
       {
        //do some work

       }
     }
   }

Ohter New class

Public class connection
{
   public int sum(int i, int b)
   {
     return i+b;
    }
 }

在ITest.svc.cs中无法访问我的连接类。请帮忙

1 个答案:

答案 0 :(得分:0)

尝试重写连接:

 namespace TestProject.Services
 {
     Public class connection
     {
        public int sum(int i, int b)
        {
          return i+b;
        }
     }
}