gpt4 book ai didi

c# - 传出消息的身份检查失败。预期的身份是

转载 作者:太空狗 更新时间:2023-10-29 17:43:52 28 4
gpt4 key购买 nike

有一个 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>

它可能仍然指向您客户的身份存储和证书

关于c# - 传出消息的身份检查失败。预期的身份是,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5578584/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com