无法找到类型WcfService1.FaultException,WcfService1,version = 1.0.0.0,Culture = neutral,PublicKeyToken = null

时间:2015-01-20 09:00:30

标签: c# .net wcf enterprise-library

我有一个简单的WCF项目,我正在尝试使用Enterprise Library v6.0,在企业库配置中我收到此警告:

  

无法找到类型WcfService1.FaultException,WcfService1,version = 1.0.0.0,Culture = neutral,PublicKeyToken = null

我找不到PublicKeyToken = null,

的原因

我在想这就是我收到这个警告的原因。你找到我的代码:

Service1.svc.cs

namespace WcfService1
{
    [ExceptionShielding("Policy")]
    public class Service1 : IService1
    {
        [FaultContract(typeof(FaultException))]
        public string GetData(int value)
        {
            throw new Exception("message test");
        }        
    }
    [DataContract]
    public class FaultException : Exception
    {
        [DataMember]
        public Guid FaultID { get; set; }
        [DataMember]
        public string FaultMessage { get; set; }
    }
}

IService1.cs

namespace WcfService1
{
    [ServiceContract]
    public interface IService1
    {
        [OperationContract]
        [FaultContract(typeof(FaultException))]
        string GetData(int value);
    }
    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class CompositeType
    {
        bool boolValue = true;
        string stringValue = "Hello ";

        [DataMember]
        public bool BoolValue
        {
            get { return boolValue; }
            set { boolValue = value; }
        }

        [DataMember]
        public string StringValue
        {
            get { return stringValue; }
            set { stringValue = value; }
        }
    }
}

企业库配置

Unable to find type WcfService1.FaultException, WcfService1, version=1.0.0.0, Culture=neutral, PublicKeyToken=null

0 个答案:

没有答案