开始开发WCF-WPF应用程序。
客户端和服务器之间的数据在消息级别加密。 根据角色,用户名和密码,使用自己的策略实施自定义身份验证和授权。
面对一个奇怪的错误。 如果简单类型或类型实现在客户端和服务器之间传输的[DataContract],则应用程序可以正常工作。 但是,当我尝试传输包含Catel库的PropertyData的项目时。 获得例外 System.Security.Cryptography.CryptographicException:(DigestVerificationFailedForReference)测试链接\“#_ 0 \”的摘要摘要。 “
的app.config
<serviceCredentials>
<serviceCertificate findValue="01" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySerialNumber" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="TS.PortraitExpertise.AuthWCF.CustomUserNameValidator, TS.PortraitExpertise.AuthWCF" />
</serviceCredentials>
模型例子
[Serializable]
public class TestModel : ModelBase
{
public TestModel()
{
}
protected TestModel(SerializationInfo info, StreamingContext context)
: base(info, context) { }
/// <summary>
/// Unique key.
/// </summary>
public int Id
{
get { return GetValue<int>(IdProperty); }
set { SetValue(IdProperty, value); }
}
/// <summary>
/// Register the Id property so it is known in the class.
/// </summary>
public static readonly PropertyData IdProperty = RegisterProperty("Id", typeof(int));
}
如果在消息级别禁用加密,则数据会正常传输。如果只序列化一个对象,然后反序列化,则操作正常完成。 如果在序列化和反序列化模型之间播放问题,Katel会添加加密。 我怎样才能解决问题并不放弃模型Catel?