Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


How to share modules between WCF webservices..

Posted on 2010-09-16
Medium Priority
Last Modified: 2012-06-22
Hi guys,

I've got a question that I thought I'd find the answer to pretty quickly, but that I'm now into my third day and can't find the answer..

We have created our first WCF webservice.  This will not be our only webservice.  We'd like to know what strategy (if any) can be used to share class modules across the webservices without having to recompile the webservices?    

On our ASP.NET site we can just copy a .cs file into the app_code directory and the website automatically uses the new code without having to publish the whole website.  Can we achieve a similar result with webservices? Basically, we'd like to create the interface and implementation in the webservice dll but only reference outside modules instead of including them in.  We'd like to be able to overwrite an existing module and have the webservice start using it without having to recompile and re-deploy the webservice.  

Is this possible?   I can't seem to find documentation on best practice for webservice design in this area.  Any help or link to a resource that discusses this would be very much appreciated.

Thanks in advance =)
Question by:aamado
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 18

Expert Comment

ID: 33699300
Hi Alan,

I'm just trying to get my head around your architecture and what you are trying to do.

This is supposed to represent a web page communicating with a WCF Web Service which communicates with outside DLL's / .cs files are you call them. An you want to be able to drop in newer versions of the outside DLL's/ cs files. The problem is that the webservice and the DLL's are compiledIs this correct?

                                                       /-> Outside DLL's modules
Web page <-> WCF/Web Services <-> Outside DLL'smodules
                                                       \-> Outside DLL'smodules

Or is it that you want to be able to actually rewrite the code.

                                                       /-> Outside modules .cs file
Web page <-> WCF/Web Services <-> Outside modules .cs file
                                                       \-> Outside modules .cs file

There are two things that I can think of, one is on this link The other thing I can think of for the latter is the Code DOM. But I'm not 100% it would work for what you want exactly. It's something to look at though


LVL 18

Expert Comment

ID: 33699315
Hi again,

Provided the interface doesn't change then you should be fine with whatever you do.

I think the first link I posted is the one you want although compiling it into a DLL will work either.



Author Comment

ID: 33705211
Hi Darren =)

Thanks for the reply,

The second example you stated is basically what we're trying to achieve.

Here's an image that would represent an example of the webservice file structure on our webserver.

Hopefully this will help explain better what i'm asking..

We would like to just be able to overwrite one of the classes (i.e. Myfunctions1.cs) and have the webservice start using it without having to recompile and publish out the webservice.

Right now what is happening is that when publishing out the webservice, the MyFunctions1.cs and Myfunctions2.cs files get compiled into the Service1.dll and that's what the Webservice references.

In our websites we can just replace the .cs files in the App_Code directory and the website will just compile the .cs file on the fly and use it right away.

I'm not sure if that type of architecture is possible with webservices.  That's what we're trying to find out.

Thanks again,
-Alan =)
LVL 18

Accepted Solution

DarrenD earned 500 total points
ID: 33707596
Hi Alan,

I think that what you want is exactly what is in  the first link that I gave you as you do not have to compile into a DLL as this is done on the fly:

I have tested this. Simply create a directory in IIS called IISServiceTest and add a sub directory call App_Code.

Then add the attached files to the following directories:


You should then be able to change the functions in Functions1.cs

This way you do not create a DLL. It is all done on the fly.

However the client will have to get the latest version of the Service Contract if new methods are added to it so that the client can see them. Services are different in that respect to normal ASP.NET

NB: Change CalcService.cs to CalcService.svc as EE would not let me upload it.

Let me know if this meets some of your requirements.

Hope this helps,


Author Comment

ID: 33708424
Hi Darren  :)

Yes that's perfect!  Just what we're looking for.  I didn't understand the link as well as I did the explanation in your last post,  thank you for that :)

Thanks again!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will show you how to add an attribute to an XML ( stream returned from a Windows Communication Foundation ( (WCF) Web Service.  Some knowled…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question