传出消息的身份检查失败。期望的身份是

发布于 2024-10-31 02:45:53 字数 4344 浏览 3 评论 0原文

我的机器上有一个运行良好的 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);

,如果您需要更多信息,请告诉我。

亲切的问候

阿什

Had a wcf service running fine on my machine.

Moved it to a server and am now getting the above error.

I produced a test certificate on the server.

Heres my client config.

<?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>

EDIT

Proxy initialisation is as follows but this is not where the error is being thrown...

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();

The error is being thrown when i make a call using the proxy eg

stockClient.messageToServerWithoutDirectReturn(moduleName, moduleType, methodName, inputs);

Please let me know if you need anymore information.

Kind Regards

Ash

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

兮子 2024-11-07 02:45:53

由于您将客户端移至另一台服务器并使用新证书,您将需要更新您的身份/证书节点:

        <identity>
            <certificate encodedValue="..." />
        </identity>

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

Since you moved the client to another server and are using a new certificate you will need to update your identity/certificate node:

        <identity>
            <certificate encodedValue="..." />
        </identity>

It is probably still pointing to your client's identity store and certificate

泪痕残 2024-11-07 02:45:53

您有两种方法可以更改它。

<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>

You have two ways to change it.

<identity>
    <certificate encodedValue="the value of base64 encoded value of the certificate that you are using">
</identity>

or

<identity>
    <certificateReference findValue="thumbprint" storeLocation="LocalMachine" storeName="My">
</identity>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文