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

  • Home
  • SEARCH
  • 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 6846789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:39:59+00:00 2026-05-27T00:39:59+00:00

I have two experimental web services. One is an asmx contained within a .net

  • 0

I have two experimental web services. One is an asmx contained within a .net web application. The other is a WCF service library being invoked from the web application.

The asmx basically does everything I need, but I think WCF would be better, except that it doesn’t do anything as I would expect after fiddling with the asmx service.

For example, the same method behaves differently in each:

' ASMX
<WebMethod(BufferResponse:=True, EnableSession:=False)>
Function Test(aObject as Object) as Object
  ' object will have been successfully serializaed into a dictionary
  Dim lResult as SomeObject = new SomeObject(aObject)
  return lResult ' lResult will be serialized as whatever type it is and will be deserialized by client making ajax call
End Function

' WCF
<OperationContract()>
<WebInvoke(RequestFormat:=ServiceModel.Web.WebMessageFormat.Json,
           ResponseFormat:=ServiceModel.Web.WebMessageFormat.Json,
           BodyStyle:=WebMessageBodyStyle.Wrapped)>
Function Test(aObject As Object) As Object
  ' object is serialized as an empty instance of Object
  ' not very useful
  Dim lResult as SomeObject = new SomeObject(aObject) ' waste of time with useless object
  return lResult ' even if lResult could be instantiated the client returns error 500 because 
                 ' WCF won't serialize SomeObject as Object
End Function

I’ve been researching this problem off and on for several months as I have time between projects. Nothing I’ve tried makes WCF do what ASMX does. Any ideas?

  • 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-05-27T00:40:00+00:00Added an answer on May 27, 2026 at 12:40 am

    The way that I see it is that you create WCF services to a specific Interface contract.

    If you can just specify any type of Object, then there is no programmatic mechanism to validate that either end of the pipe has correctly implemented that Interface.

    I have found WCF to be generally much more restrictive than ASMX in terms of class serialization and deserialization, but switching to WCF from ASMX has tremendously improved our applications in terms of stability, maintainability, and productivity.

    Having said that, there is no reason to switch to WCF just because it is WCF. You need to identify exactly why you think it is better for your situation and, if it is, then you need to create some test cases using actual classes instead of just Objects to verify that it will meet your needs.

    One thing to think about: if you are consuming WCF services in your own .Net applications written in Silverlight, WPF, or WinForms, then WCF will make your life a lot easier in the long run because it makes it possible to share the same business object class code on both ends of the pipe.

    Update with info from comments

    Actually, you can serialize abstract classes as long as they can be deserialized to concrete implementations. You can do this by attributing the abstract class with the KnownType attribute for each of the concrete classes that you want to serialize.

    The primary issue is not the service interface contract, it is the DataContract which requires a concrete class at some point. This link describes the rules.

    You could create a catchall class that inherits from object and is decorated with known type for the classes you want to use.

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

Sidebar

Related Questions

We need to be able to run two versions of one ASP.net web application
I'm trying to make an experimental web application which minimises redundant data. I have
I have an activity which checks username availability via .net web services, I need
I have two applications written in Java that communicate with each other using XML
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources
I have two spreadsheets... when one gets modified in a certain way I want
Greetings, Basically, I have two vectors of data (let's call it experimental and baseline).
I have two branches: master and experimental . I'd like to rebase the changes
I am evaluating some web application frameworks out there, and finally, two of the

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.