![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Error in WCF IEndpoingBehavior when creating a new Message. I am working on a custom WCF EndpoingBehavior that will modify the messages coming in and out of my Service. I am having an error related to the modification of the message in the IEndpointBehavior.AfterReceiveRequest(ref Message request,...) method. In the method that creates a new message, I have something similar to ... /// xmlReader defined with new modified content.... /// 'message' is the original message... Message newMsg = Message.CreateMessage( message.Version, null, xmlReader ); // Preserve the headers of the original message newMsg.Headers.CopyHeadersFrom( message ); foreach (string propertyKey in message.Properties.Keys) newMsg.Properties.Add(propertyKey, message.Properties[propertyKey]); // Close the original message and return new message message.Close( ); return newMsg; This is similar to other code that I have seen on the Internet related to creating a new message from an existing one. This code ran fine when under the XP ASP.NET Development server, but when run on Windows 2003 Server (basicHttpBinding, HTTPS, Authentication) I immediately get an error on the server side after the AfterReceiveRequest method completes and processing the message. I get the following error... System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.ServiceModel.Security.SecurityMessageProperty'. at System.ServiceModel.Security.SecurityMessageProperty.ThrowIfDisposed() at System.ServiceModel.Security.SecurityMessageProperty.get_ServiceSecurityContext() at System.ServiceModel.Dispatcher.SecurityImpersonationBehavior.GetAndCacheSecurityContext(MessageRpc& rpc) at System.ServiceModel.Dispatcher.SecurityImpersonationBehavior.StartImpersonation(MessageRpc& rpc, IDisposable& impersonationContext, IPrincipal& originalPrincipal) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) I see where there was a similar bug in .NET before it was officially release and supposedly fixed, http://connect.microsoft.com/wcf/fee...dbackID=202762 Apparently, something in the new message or in the processing still keeps a reference to the original Message and throws an error if it is closed. If I remove the message.Close() then things work ok. Any ideas on how to properly create a new Message? What is the downside if I do not close the original message? Thanks, Ron |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Logical option for creating email Message Rules. | Avery Tom Deacon Harry | Vista mail | 4 | 07-08-2008 12:44 PM |
| Error creating favorites in IE7 | Qu0ll | Vista General | 9 | 04-21-2008 06:38 AM |
| Windows Mail Error Sending a Message - Non-specific Error Message | DP4Jesus7 | Vista mail | 8 | 04-09-2008 02:37 PM |
| Slowness of creating or replying to a message | Judi Adams | Vista mail | 1 | 12-11-2007 08:55 PM |
| Error Message in Creating Recovery Discs | Truongs | Vista General | 1 | 05-06-2007 05:19 PM |