.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Alternative ways to handle circular references in WCF service?

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :WCF

I have a huge business library and I am building WCF Service on top of it. I know that since WCF 3.5 SP1 I can serialize circular references using [DataContract(IsReference=True)] but is there any other way?

Could I for example write a custom attribute for a class which tells serializer that every member of the class is a data member?

I am asking this because if I add DataContract attribute to my class I also have to add DataMember attribute to every member I want to share through WCF service. That is a lot of extra work and markup I would like to avoid.

View Complete Post

More Related Resource Links

Problem consuming 32bit WCF service which references a native Dll in a 64 bit OS(Windows Server 2008

I have some 32bit Dlls which i want to use it in 64bit OS as i do not have a source code of this to recompile it for 64 bit OS. I have created a x86(32 Bit) WCF service which calls these Dlls and hosted it as a Windows Service on a x64(64 Bit) machine using Windows Server 2008. I have created one more x64 client which calls a function in the WCF which in turn calls a function from the 32 bit native Dll. Whenever i try calling this WCF from the client I get an error as given below.Can anybody please guide as to where I am going wrong and what is needed to solve this issue. Thanks in advance for any help.******The Error Message********************System.BadImageFormatException: Could not load file or assembly 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.File name: 'TestWCFWrapper, Version=, Culture=neutral, PublicKeyToken=null'   at TestWrapperWCFClient.Form2.button1_Click(Object sender, EventArgs e)   at System.Windows.Forms.Control.OnClick(EventArgs e)   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)   at System.Windows.Forms.Control.WndProc(Message& m)   at System.Windows.Forms

Can a 64 bit app host a service which references 32 bit libraries?


I have a 64 bit application which needs to remain 64 bit - address space, performance etc. The target platform is 64 bit Windows. This 64 bit app will be calling into some legacy 32 bit libraries via WCF. We are not going to rewrite the legacy libraries for 64 bit, so the idea is we will write services where the service code itself calls into the legacy libs, and the 64 bit app uses those services.

Architecturally, the only way I can see to do this is that the host will have to be in a separate process, which will be a 32 bit process since it will be referencing the legacy libraries.

The out of proc model is ok, but I like the idea of the 64 bit process being able to self host.  Of course I don't want to introduce any 32 bit dependencies.

Are there any patterns or tools available that might allow me to accomplish this?




Circular File References


Hi everoyne,

Ok, I've googled this for an extended period of time, but everything I see relates to ASP.Net 2.0, and Visual Studio 2005 and error about file locations and batch debugging, but I'm pretty sure this is not the problem I'm having. Heres the scenario. I have a Master page in my root folder called Site.master. There is a folder in my root called Members. Inside this folder I have two master pages, Full.master and Inner.master that both inherit from Site.master in the root folder. I am getting two Circular file reference errors when I try to rebuild or publish my application. The errors are located in the line 1 of full.master and inner.master here they are


<%@ Master Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Full.master.cs"
    Inherits="Members_Full" %>


<%@ Master Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Inner.master.cs"
    Inherits="Members_Inner" %>

and here is Site.master

<%@ Master Language="C#" CodeFile="Site.master.cs" Inherits="Site" %>



What are the different ways of calling WCF service from client ?


What are the different ways of calling WCF service from client ?

Few are :

Is there any other way which can offer more flexibility,  or make implementation loosely coupled ?
Best Regards, Uday Kadam

Can Windows Service handle Data Staging and load operations?



I am developing an application which requires data staging, WCF module to consume web service app and data loading Module. The data staging module will work with SSIS package and data load module will use Stored Procedures and WCF module which will consume web service and send data from the staged tables.

All these modules will be part of single application which will be configured as a Windows Service at the server end. Development platform: VS2010,C#4.0

Given that, can Windows service handle all the above operations? How can I use error handling effectively? Since this is a background process, I need very good error and trace handling routines.

Appreciate any inputs or references on these. 





Generated Service References now use XElement not XmlElement since 2010 Upgrade


We've just upgraded from VS2008 to VS2010 and we're having issues with the generated code of service references.

Where previously the generated code used XmlElement classes, it now used the LINQ class XElement. As a result the projects do not compile.

We have a workaround of reverting the Reference.cs files back to the version prior to the upgrade, but this will only work for us until the point at which we need to regenerate the service references, and as we're actively developing the services, that's likely to be very soon.

Is there way to make the service references generate code using XmlElement not XElement?

For reference, the problem is most acute where we're using a SharePoint list, I know that's not going to need regenerating anytime soon, but we do have some of our own services that return XML data.

I know this isn't strictly a "Setup and Installation" question, but I couldn't establish what the correct forum would be.

Multiple service references in scriptmanager...is it possible?


Hi All,


I am having problem including multiple service references in scriptmanager element on a page. That is not possible?

Please refer to the below thread for more information about my problem:


3 Ways to generate proxy for WCF Service

A Proxy in Windows Communication Foundation is a class that enables client applications to communicate with a service by sending and receiving messages. It actually encapsulates a number of service details like service path, service implementation technology, platform being used, communication protocol etc. as well as all the methods (signature only) of the Service Contract.

Six easy ways to customize your site using Web Parts in SharePoint

Becoming familiar with Web Part customization techniques gives you a range of page-customization choices. For example, you can customize your site's home page so that it displays the specific information that your team needs. You can rearrange the list items on the home page, add lists, and even change the images on the home page. As you become more familiar with Web Part Page customization techniques, you can build interactive Web Part Pages that makes the data in lists more dynamic and useful, and you can add new Web Parts that provide access to external data and Web services.

Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

Web Service for uploading documents into SharePoint

WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Rendering ASP.NET Script References into the Html Header

One thing that I've come to appreciate in control development in ASP.NET that use JavaScript is the ability to have more control over script and script include placement than ASP.NET provides natively. Specifically in ASP.NET you can use either the ClientScriptManager or ScriptManager to embed scripts and script references into pages via code.

Creating and Using an ASP.NET Web Service in Visual Web Developer

In addition to letting you create Web pages, Microsoft Visual Studio also lets you create Web services that use ASP.NET XML. Creating a Web service in Visual Studio is similar to creating a Web page. You can also use the Microsoft Visual Web Developer Web development tool to reference and use Web services that are in a Visual Web Developer solution, on your local computer or in a local or external UDDI directory. In this walkthrough, you will create the Web service in one solution and use it in another.

Tasks illustrated in this walkthrough include:

Creating a simple XML Web service in Visual Web Developer.

Creating a separate Web site that uses the Web service.

*.axd script references not being rendered to browser


I'm running VS2010 with .net 4.0, and am running into issues with the .net ajax script tags mysteriously not being rendered to the browser.

So far I've reduced it to a scenario where I set the DataSourceID property of a databound control.  More specifically, I've only tested it on a Gridview and a DropDownList.

This can be reproduced fairly easily on my machine by following these steps:

1. Create a new empty Web Application Project

2. Create a new Web Form

3. Add a ScriptManager inside the form

4. Add a DropDownList and a DataSource (I used an ObjectDataSource)

5. Set the DataSourceID property of the DropDownList to the ID of the DataSource.  This can be done either declaratively on the .aspx page, or in the code behind in the aspx.cs page, and both produce the same results.

6. Open the page in a browser and watch as you get a javascript error stating "Sys is not defined" and notice that the page source contains no script tags referencing *.axd scripts.

Here's my source code showing my set up:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ScriptResourceFAIL.Default" %>


AutoGenerateSelectButton="False" ignored when using Domain Service


Crosspost from RIA Services forum: http://forums.silverlight.net/forums/t/196466.aspx

I'm creating a Dynamic Data application in VS2010 and have recently switched to using a Domain Service to give greater control over the data presented to the client. I've noticed that the AutoGenerate<Action>Button attributes on my GridView are being ignored. The presence of the Edit and Delete buttons appear to be contingent on the existence of Update and Delete methods on the partial classes autogenerated in the Domain Service, but i'm not seeing how to control the generation of the Select button. Is there a way to control this from within the Domain Service class?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend