我有一个简单的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; }
}
}
}
企业库配置