473,836 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error in WCF IEndpoingBehavi or when creating a new Message.

I am working on a custom WCF EndpoingBehavio r 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
IEndpointBehavi or.AfterReceive Request(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.CreateM essage( message.Version ,
null, xmlReader );

// Preserve the headers of the original message
newMsg.Headers. CopyHeadersFrom ( message );

foreach (string propertyKey in message.Propert ies.Keys)
newMsg.Properti es.Add(property Key, message.Propert ies[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 (basicHttpBindi ng, HTTPS, Authentication) I immediately
get an error on the server side after the AfterReceiveReq uest method
completes and processing the message. I get the following error...

System.ObjectDi sposedException : Cannot access a disposed object.
Object name: 'System.Service Model.Security. SecurityMessage Property'.
at
System.ServiceM odel.Security.S ecurityMessageP roperty.ThrowIf Disposed()
at
System.ServiceM odel.Security.S ecurityMessageP roperty.get_Ser viceSecurityCon text()
at
System.ServiceM odel.Dispatcher .SecurityImpers onationBehavior .GetAndCacheSec urityContext(Me ssageRpc&
rpc)
at
System.ServiceM odel.Dispatcher .SecurityImpers onationBehavior .StartImpersona tion(MessageRpc &
rpc, IDisposable& impersonationCo ntext, IPrincipal&
originalPrincip al)
at
System.ServiceM odel.Dispatcher .DispatchOperat ionRuntime.Invo keBegin(Message Rpc&
rpc)
at
System.ServiceM odel.Dispatcher .ImmutableDispa tchRuntime.Proc essMessage5(Mes sageRpc&
rpc)
at
System.ServiceM odel.Dispatcher .ImmutableDispa tchRuntime.Proc essMessage4(Mes sageRpc&
rpc)
at
System.ServiceM odel.Dispatcher .ImmutableDispa tchRuntime.Proc essMessage3(Mes sageRpc&
rpc)
at
System.ServiceM odel.Dispatcher .ImmutableDispa tchRuntime.Proc essMessage2(Mes sageRpc&
rpc)
at
System.ServiceM odel.Dispatcher .ImmutableDispa tchRuntime.Proc essMessage1(Mes sageRpc&
rpc)
at System.ServiceM odel.Dispatcher .MessageRpc.Pro cess(Boolean
isOperationCont extSet)

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

Jun 12 '07 #1
0 1977

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7071
by: Robert Hogan | last post by:
Hello, I am attempting to send emails using T-SQL (in a SQLServerAgent Job) using the stored procedure sp_SendSMTPMail. I created the stored proc using the following script that I got off a post here on google. CREATE PROCEDURE sp_SendSMTPMail (@From varchar(255), @To varchar(8000), @Subject varchar(255), @Body varchar(8000),
6
6129
by: owen | last post by:
Generally speaking, what does it mean when I see a "button" with red text showing this message instead of the control I've dragged onto the web form in Design View.? (But the page works fine at runtime). Does it indicate a problem with References for example? Thanks Owen PS. replies cc'd by email appreciated. owen.southwood@mantix.com
4
561
by: Altramagnus | last post by:
I have 30 - 40 type of different window. For each type I need about 20 instances of the window. When I try to create them, I get "Error creating window handle" My guess is there is a maximum number of window handle, because if I reduce to about 2 instances of each window, it can run. But not 20 instances of each window. Does anyone know what the problem is? is it really because it exceeds the maximum number of window handle?
11
3147
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some useful utils that more pages on that server can use. As an example, I have created a Page Counter class that opens an Access .mdb file, counts the current entries for that page, and adds a new entry with some information regarding the current...
7
5037
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
0
2137
by: Ravi Ambros Wallau | last post by:
Hi: I've created a custom control - a grid that uses Infragistics to display some filters, the grid itself, and some buttons. Well, when using this control directly on WebForm, everything works really fine. No problems at all. But, when this control is placed inside a template of an Infragistics UltraWebTab control, somethings stranges happens: 1. When the WebForm is opened, an "Error Creating Control" message is displayed (for container...
5
3654
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As New System.Diagnostics.Process 'p.Start(MDEPDirStr & "macrun.exe", sPPTOut) p.Start("C:\WINDOWS\SYSTEM32\CALC.EXE") 'p.Start("C:\WINDOWS\SYSTEM32\macrun.exe", sPPTOut)
0
6617
by: Herman Jones | last post by:
I'm getting the following error when I build a Class Library project: Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'. It happens with every the of C++ project I try to build. Not just Class Libraries, but a plain Windows Form Application as well. I've tried creating new projects with nothing but shell built by the Wizard, but I still get the error.
2
5339
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
0
9673
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10859
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9388
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6984
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4463
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.