Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7915383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:26:05+00:00 2026-06-03T14:26:05+00:00

This is my ABC on the server side: <endpoint address=msmq.formatname:DIRECT=OS:.\private$\imhmsgs binding=msmqIntegrationBinding bindingConfiguration=IncomingMessageHandlerBinding contract=TMC.Services.Contracts.Messages.IInboundMessageHandlerService> As

  • 0

This is my ABC on the server side:

<endpoint address="msmq.formatname:DIRECT=OS:.\private$\imhmsgs" 
          binding="msmqIntegrationBinding" 
          bindingConfiguration="IncomingMessageHandlerBinding" 
         contract="TMC.Services.Contracts.Messages.IInboundMessageHandlerService">

As soon as I do an .Open() to host the service, I get the exception:

Cannot serialize interface
XYZ.Services.Contracts.Messages.Interfaces.IMyMessage.

My IMyMessage interface:

[ServiceContract]
[ServiceKnownType(typeof(IMyMessage))]
[ServiceKnownType(typeof(ConcreteMessage))]
public interface IInboundMessageHandlerService
{
    [OperationContract(IsOneWay = true, Action = "*")]
    void ProcessIncomingMessage(MsmqMessage<IMyMessage> incomingMessage); 
}

The implementor for that interface:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, 
                 ReleaseServiceInstanceOnTransactionComplete = false)]
public class InboundMessageHandlerService : IInboundMessageHandlerService
{
    [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
    public void ProcessIncomingMessage(MsmqMessage<IMyMessage> incomingMessage)
    {
    }
 }

The type that is being created by the client basically is a concrete class, which derives from a base class and also an interface (IMyMessage) and then places this on the MSMQ.

After some testing, if I remove the service known type attributes and just instead use say “string” instead, then it seems to open the host but faults (because the message type is not what it was expecting).

where am I going wrong?

On further testing I see that if I only specify the concrete type, it works.

This is not quite what I was expecting.
how am I able to create it so that the service can take a known interface and classes which that interface has? The idea is for the client (using the same contract and classes) to send the message as “IMyMessage” and for the WCF service to pick that up as “IMyMessage” and go ahead and find out the type of message/object it is.

How?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:26:08+00:00Added an answer on June 3, 2026 at 2:26 pm

    Your contract is an interface, but the definition within the contract must be concrete classes.

    In your case it looks like you want to send over a list of things, those things could be different but they all support the same interface.

    The problem is that when WCF deserialises what has been sent over the wire, it needs to deserialise it the a concrete type. If it just has an interface in the definition and 20 different types that implement that definition, it does not know what to do with it.

    What you can do is have a base type that implements the interface, all your classes inherit from the base type and you use the base type in your contact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a repository, say abc/myprject.git . I have this repo on a server
I have this list of files on a Linux server: abc.log.2012-03-14 abc.log.2012-03-27 abc.log.2012-03-28 abc.log.2012-03-29
I want to split a string like this: abc//def//ghi into a part before and
A Tcl nested String can be something like this: {abc {xyz foo {hello world}}}
I have a file that looks something like this: ABC DEF GHI I have
If I have a function like this: function abc($a,$b,$c = 'foo',$d = 'bar') {
System.out.println( Arrays.deepToString( abc<def>ghi.split((?:<)|(?:>)) ) ); This prints [abc, def, ghi] , as if I
I have a file (dictionary.txt) with data field entries as follows - ABC This
Consider a table or CTE structured like this: Name Num ---- ---- Abc 12
My goal is to have the url routing as following: http://www.abc.com/this-is-peter-page http://www.abc.com/this-is-john-page What is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.