Сделал веб-сервис WCF в ASP .NET приложении, привязал аутентикацию к ASP .NET Membership. Клиент - Windows-приложение.
Почему-то периодически глючит эту связку. Т.е. обычно всё работает как надо, но иногда вылетает странное исключение System.ServiceModel.Security.MessageSecurityException:
************** Exception Text **************
System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail. ---> System.ServiceModel.FaultException: The message could not be processed. This is most likely because the action 'http://tempuri.org/ISmartClientService/GetProductsForCategory' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
--- End of inner exception stack trace ---
Server stack trace:
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.ProcessReply(Message reply, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.SecurityRequestSessionChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at PromoShoppingClient.SmartClientService.ISmartClientService.GetProductsForCategory(Category Category)
at PromoShoppingClient.SmartClientService.SmartClientServiceClient.GetProductsForCategory(Category Category) in D:\Documents and Settings\Павел\Мои документы\visual studio 2005\Projects\PromoShoppingService\PromoShoppingClient\Service References\SmartClientService.vb:line 826
at PromoShoppingClient.MainForm.LoadProductsForCategory(Category Category) in D:\Documents and Settings\Павел\Мои документы\visual studio 2005\Projects\PromoShoppingService\PromoShoppingClient\MainForm.vb:line 238
at PromoShoppingClient.MainForm.SyncProductsCategory() in D:\Documents and Settings\Павел\Мои документы\visual studio 2005\Projects\PromoShoppingService\PromoShoppingClient\MainForm.vb:line 213
at PromoShoppingClient.MainForm.CategoriesTree_AfterSelect(Object sender, TreeViewEventArgs e) in D:\Documents and Settings\Павел\Мои документы\visual studio 2005\Projects\PromoShoppingService\PromoShoppingClient\MainForm.vb:line 245
at System.Windows.Forms.TreeView.OnAfterSelect(TreeViewEventArgs e)
at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv)
at System.Windows.Forms.TreeView.WmNotify(Message& m)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Почему такое может быть, и как это победить?