错误“未实现接口成员”在WCF C#中 [英] error "does not implement interface member" In WCF C#

查看:119
本文介绍了错误“未实现接口成员”在WCF C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的WCF应用程序出错了

i希望在WCF应用程序中使用类



.CS文件



Hi I Have Error in my WCF app
i want to using a class in WCF application

.CS File

namespace AccessService
{
  [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        string GetData(int value);

        [OperationContract]
        string GetProvider(string IP, string Serial);

        [OperationContract]
        DatabaseProviderProp SendConnectionProv(DatabaseProviderProp Composite);

    }


 [DataContract]
    public class DatabaseProviderProp
    {

        string ServIP;
        string DbName;

        [DataMember]
        public string ServerIP
        {
            get { return ServIP; }
            set { ServIP = value; }
        }

        [DataMember]
        public string DatabaseName
        {
            get { return DbName; }
            set { DbName = value; }
        }

    }
}





.SVC.CS文件





.SVC.CS File

namespace AccessService
{
    public class AccessServ : IService1
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public string GetProvider(string IP, string Serial)
        {
            ConnectionProviders ConProv = new ConnectionProviders();

            if (ConProv.CheckIP(IP) == true)
            {
                if (ConProv.SearchSerial(Serial) == true)
                {
                    return "Ok";
                }
                else
                {
                    if (ConProv.ExProperty == null)
                    {
                        return "Eror In Serial Or Your Requst IP";
                    }
                    else
                    {
                        return ConProv.ExProperty;
                    }
                }
            }
            else
            {
                if (ConProv.ExProperty == null)
                {
                    return "Eror In Serial Or Your Requst IP";
                }
                else
                {
                    return ConProv.ExProperty;
                }
            }
        }

        

        public  DatabaseProviderProp SendConnectionProv(string Serial)
        {
 			 DatabaseProviderProp Database = new DatabaseProviderProp();
            Database.DatabaseName = "Hi All";
            return Database;
        }
    }
}





AccessServ类错误

我不想在SendConnectionProv中添加DatabaseProviderProp类作为参数,但是当我这样做时,错误隐藏

i想要添加Serial作为参数,将DatabaseProviderProp添加为变量



谢谢...



Error In "AccessServ" Class
I do not want to add DatabaseProviderProp class in SendConnectionProv as parameter but when i do that error hide
i want to add a "Serial" as a parameter and the DatabaseProviderProp as variable

thanks...

推荐答案

所有接口成员应始终在实现接口的类中实现。这与WCF无关,这就是.NET的设计方式。 (谢天谢地;没有这个错误导致灾难。)



-SA
All interface members should always be implemented in the class implementing an interface. This is not related to WCF, this is how .NET is designed. (Thanks goodness; not having this error causes disaster.)

—SA


这篇关于错误“未实现接口成员”在WCF C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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