0

Windowsサービスの任意のマシンでwcfサービスを介してリモートdllを使用しようとしましたが、wcfサービスから次のエラーが返されました:

CommunicationException: 相手から、非セキュアまたは不適切にセキュアな障害が受信されました。障害コードと詳細については、内部の FaultException を参照してください。

私のwcfサービスはうまく機能しています。また、PROCESS.dll を呼び出す wcf サービスを呼び出します。私はwcfサービスを動的に呼び出しています:


  public static ApplicationHostServiceClient CreateApplicationHostService()
        {
            try
            {
                int maxDifference = 300;
                WSHttpBinding binding = new WSHttpBinding();
                binding.MaxReceivedMessageSize = int.MaxValue;
                binding.MaxBufferPoolSize = int.MaxValue;
                binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
                CustomBinding myCustomBinding = new CustomBinding(binding); //CreateMultiFactorAuthenticationBinding(binding);

                // Set the maxClockSkew
                var security = myCustomBinding.Elements.Find();
                security.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);
                security.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

                // Set the maxClockSkew
                var secureTokenParams = (SecureConversationSecurityTokenParameters)security.ProtectionTokenParameters;
                var bootstrap = secureTokenParams.BootstrapSecurityBindingElement;
                bootstrap.LocalClientSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);
                bootstrap.LocalServiceSettings.MaxClockSkew = TimeSpan.FromMinutes(maxDifference);

                // Update the binding of the endpoint
               // service.Description.Endpoints[0].Binding = myCustomBinding;




                EndpointAddress endpoint = new EndpointAddress(new Uri(ProcessApplication.Serverparameters.BaseServiceHost + "/Service/ApplicationHostService.svc"));
                ApplicationHostServiceClient ser = new ApplicationHostServiceClient(myCustomBinding, endpoint);

                return ser;
            }
            catch (Exception exc)
            {

                ProcessApplication.Application.OnError("CreateApplicationHostService is not              succeeded.", "CreateApplicationHostService", exc);
                return null;
            }

        }

しかし、上記のエラーが発生します。セキュリティ例外を解決するにはどうすればよいですか?

4

0 に答える 0