473,771 Members | 2,328 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 1974

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

Similar topics

3
7067
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
6127
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
3141
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
5024
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
2135
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
3646
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
6611
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
5332
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
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
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...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
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
7460
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.