您好,我正在处理WCF应用程序.我面临着从具有不同时区的客户端访问WCF服务的问题.当我在各种论坛上阅读时,我发现一个属性 "Maxclockskew" ,需要在客户端&服务器.我正在使用NetTCPBinding来应用以下解决方案来设置MaxClockSkew属性 公共类ClockSkew {{ binding); SecurityBindingElement bindingElement = customBinding.Elements.Find< SecurityBindingElement>(); 如果(bindingElement!= null) > bindingElement.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue;结果,bindingElement.LocalClientSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue;搜索结果bindingElement.LocalServiceSettings.DetectReplays = FALSE;结果,bindingElement.LocalServiceSettings.MaxClockSkew = TimeSpan.MaxValue ; ing bindingElement.LocalServiceSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue; SecurityTokenParameters tokenParameters =((SymmetricSecurityBindingElement)bindingElement).ProtectionTokenParameters;结果,如果(tokenParameters是SecureConversationSecurityTokenParameters)结果,{结果SecureConversationSecurityTokenParameters SCT = tokenParameters作为SecureConversationSecurityTokenParameters;结果,bindingElement = sct.BootstrapSecurityBindingElement;搜索结果bindingElement.LocalClientSettings.DetectReplays = FALSE;结果,bindingElement.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue;结果,bindingElement.LocalClientSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue;搜索结果bindingElement.LocalServiceSettings.DetectReplays = FALSE; <无线电通信绑定属性. meSpan.MaxValue; } } 返回customBinding;使用上面的代码设置MaxClockSkew后,它在几个时区都可以正常工作,但在所有情况下都不能正常工作.我的要求是WCF服务应该可以从任何客户端(具有不同时区)访问.有什么解决办法吗?还是有什么方法可以删除时区限制以访问WCF服务?
Hi masters, I am working on WCF application. I am facing an issue of accessing WCF service from client with different timezone.As i read on various forums, and i found a property "Maxclockskew" which needs to be set on client & server. I am using NetTCPBinding to i applied following solution to set MaxClockSkew propertypublic class ClockSkew { public static Binding AdjustClockSkew(Binding binding) { CustomBinding customBinding = new CustomBinding(binding); SecurityBindingElement bindingElement = customBinding.Elements.Find<SecurityBindingElement>(); if (bindingElement != null) { bindingElement.LocalClientSettings.DetectReplays = false; bindingElement.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue; bindingElement.LocalClientSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue; bindingElement.LocalServiceSettings.DetectReplays = false; bindingElement.LocalServiceSettings.MaxClockSkew = TimeSpan.MaxValue; bindingElement.LocalServiceSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue; SecurityTokenParameters tokenParameters = ((SymmetricSecurityBindingElement)bindingElement).ProtectionTokenParameters; if (tokenParameters is SecureConversationSecurityTokenParameters) { SecureConversationSecurityTokenParameters sct = tokenParameters as SecureConversationSecurityTokenParameters; bindingElement = sct.BootstrapSecurityBindingElement; bindingElement.LocalClientSettings.DetectReplays = false; bindingElement.LocalClientSettings.MaxClockSkew = TimeSpan.MaxValue; bindingElement.LocalClientSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue; bindingElement.LocalServiceSettings.DetectReplays = false; bindingElement.LocalServiceSettings.MaxClockSkew = TimeSpan.MaxValue; bindingElement.LocalServiceSettings.SessionKeyRenewalInterval = TimeSpan.MaxValue; } } return customBinding; } }I want to set MaxClockSkew to maximum value. After setting MaxClockSkew using above code it works fine for few timezone but not in all cases(timezone).My requirement is WCF service should be accessible from any client (Having different timezone). Is there any solution for that? or is there any way to remove timezone constraint to access WCF service?
推荐答案这已在稍有不同的地方进行了讨论.方式,但解决方案在于: social.msdn.microsoft/Forums/zh-CN/wcf/thread/3e246fff-3ad3-4080-a1a6-927245f1c94f/ - Phani This is already discussed in slightly different manner, but there in lies the solution:social.msdn.microsoft/Forums/en-US/wcf/thread/3e246fff-3ad3-4080-a1a6-927245f1c94f/-Phani
更多推荐
在不同时区访问WCF服务
发布评论