views:

194

answers:

2

I'm architecting a WPF application using the PnP Composite Application Guidance. The application will be run locally, within our intranet.

Modules will be loaded dynamically based on user roles. The modules must therefore be accessible to the application through a network share, thus accessible from the client machines.

What I'd like to do is keep all the module .dlls in a location not accessible to staff, but still be able to provide them to the composite application when demanded and when the current user is authenticated to use that module.

My thought is to load the .dlls by streaming them down from a WCF service, where the WCF service (on the server) can access the .dll repository, but none of the client machines can access it. Authentication would also be handled by the service.

I suspect that I might be overcomplicating things somehow.

Is this something that can be done with a simple filesystem configuration and programmatically passing credentials when accessing the shared folder? If I do this, would access only be granted to the calling application, or would the logged-on user now be able to navigate to the shared folder?

Is this, in any way, a solved problem with MEF or any other project of which you're aware? (I hope this isn't LMGTFY-worthy -- I haven't been able to come up with anything.)

+1  A: 

Hi,

when loading modules you need to keep in mind that:

  • Once loaded, an assembly can't be unloaded (unless you unload the entire application domain) - so if users can log in and out using the same instance, you may have a problem.

  • "the load context" matters (see http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx) - this may cause problems if you have dependencies between modules or dependencies on assemblies that are not in the "load context"

If the restricted access to dlls is due to a licensing issue, maybe you need to refine the licensing mechanism somehow (not tie it to access to the actual code, but to some other checks)?

Miron Brezuleanu
No licensing issues. With respect to users logging in and out using the same instance, I assume that means accessing the .dll over the network? I had in mind actually copying down the .dll to the client machine before loading it. Also, I won't need to unload any assemblies once running. From my reading of the post to which you linked, am I right in thinking that I can copy the .dll beneath the ApplicationBase of the composite application's shell and then load into the "Load context"?
Jay
Hi, about the last question: beneath `ApplicationBase` and inside `PrivateBinPaths`. I can't figure out why you won't let the user have access to the DLL - can the DLL be used without being loaded into your APP? Are you doing the security checks only when loading the DLLs? You should do all the security checking on the server. I guess the point is, since the request of restricting access to code is a bit weird, you should provide the reason behind it, so maybe better solutions can be provided. Even if there's no better solution, I'll be able to stop guessing :-)
Miron Brezuleanu
A: 

At Argonne National Laboratory we keep all sharable DLL and other objects (.INI files, PowerBuilder PBD libraries, application software, etc.) on a simple and internally public file server and objects are being downloaded over the network on a per need basis as defined by each client/server application. Thus we are minimizing the maintenance of middleware (Oracle Client, PowerBuilder, Java, Microsoft, ODBC, etc.) to a single file server location with basically no software installed on the end user PC. Typically we physically download less than a few KB Registry Keys to the individual end user PC; this includes the full Oracle Client, which if installed on the PC alone would take up 650+ MB disk space and several thousand Registry Keys, and costly to maintain on the enterprise. Instead our Oracle Client on the PC is about 17KB.

The only “software" on the client side are Registry Keys containing variables pointing to server locations (f.ex. ORACLE_HOME: \\ORACLE\v10\Ora10g ).

This has been a very cost effective solution we have been using for 10+ years, making all middleware and application software upgrades totally transparent to more than 2000 users Lab wide. Over the years we have done thousands of object upgrades on the central file server without ever having to install a single upgrade on the end user Desktop. Although this has some risks (“thou shall not copy DLLs over the network”, etc.) and is a heavily customized solution, it has worked flawlessly for us throughout for a large number of applications and middleware.

This is a somewhat surprisingly simple solution in today’s advanced technology, but it has been totally efficient and cost effective for us. Several vendors (Citrix and others) have looked at our solution somewhat perplexed, but every vendor of deployment techniques who have seen our deployment has come to the same conclusion, basically: “you do not need us”.

Harald Johnstad [email protected]

Harald Johnstad