[英]The identity check failed for the outgoing message. The expected identity is
有一個wcf服務在我的機器上正常運行。
將其移至服務器,現在出現上述錯誤。
我在服務器上制作了測試證書。
繼承人我的客戶端配置。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IMessageHandlerServer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" clientBaseAddress="http://192.168.1.74:8081">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="UserName" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.100:8080/" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IMessageHandlerServer"
contract="MessageService.IMessageHandlerServer" name="WSDualHttpBinding_IMessageHandlerServer" behaviorConfiguration="myClientBehavior">
<identity>
<certificate encodedValue="AwAAAAEAAAAUAAAA9fenyF3cSS38ldDDxtUyC8TajBAgAAAAAQAAALgBAAAwggG0MIIBYqADAgECAhD3kPMzVBbXlEAT5S65MldSMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTEwMjExMTU0MDMwWhcNMzkxMjMxMjM1OTU5WjAXMRUwEwYDVQQDEwxNeVNlcnZlckNlcnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ9D8W2GBGvwTAZ2eQj12atxPruZxuOwTCLXRwtEvpnoLmlwBuxo7Wb+of0k4XTNLa7q/Xvjh3zsJbvevlPG3hk9+ugds/Je5X69uPbQApYJO2HZNY9hrwfMZ40iaJ54vVAkdnIhDT5pEpmKVFFkPangk1aMyb6Ilm4NjO9bUxjFAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAGT7q1aZwAaJ4sMbv53BOo2/yVSpYkTRIaQwT0uYdY1SLyJ7uaUwqJR0jG+nNqwgyOEOfg4Tz0/dX740dw12+1Q==" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="myClientBehavior">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="Custom" customCertificateValidatorType="MyX509Validator,MessageHandlerClient" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
編輯
代理初始化如下,但這不是錯誤被拋出的地方......
InstanceContext context = new InstanceContext(new MyCallback());
Configuration stockConfiguration = ConfigurationManager.OpenMappedExeConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = @"C:\Users\Ash\Desktop\Config\app.config" }, ConfigurationUserLevel.None);
ConfigurationDuplexChannelFactory<MessageHandlerClient.MessageService.IMessageHandlerServerChannel> stockChannelFactory = new ConfigurationDuplexChannelFactory<MessageHandlerClient.MessageService.IMessageHandlerServerChannel>(context, "WSDualHttpBinding_IMessageHandlerServer", null, stockConfiguration);
stockChannelFactory.Credentials.UserName.UserName = "test";
stockChannelFactory.Credentials.UserName.Password = "test";
stockClient = stockChannelFactory.CreateChannel();
當我使用代理進行呼叫時,會拋出錯誤,例如
stockClient.messageToServerWithoutDirectReturn(moduleName, moduleType, methodName, inputs);
如果您需要更多信息,請告訴我。
親切的問候
灰
由於您將客戶端移動到另一台服務器並使用新證書,因此您需要更新您的身份/證書節點:
<identity>
<certificate encodedValue="..." />
</identity>
它可能仍然指向您客戶的身份存儲和證書
你有兩種方法可以改變它。
<identity>
<certificate encodedValue="the value of base64 encoded value of the certificate that you are using">
</identity>
要么
<identity>
<certificateReference findValue="thumbprint" storeLocation="LocalMachine" storeName="My">
</identity>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.