Click here to Skip to main content
15,846,571 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi ya'll,

don't ask me why, but I'm trying to install a service using InstallUtil.exe and the assembly is located on a network drive, e.g.:

InstallUtil.exe Z:\somepath\MyService.exe

This is what I'm getting:

Exception occurred while initializing the installation:
System.IO.FileLoadException: Could not load file or assembly 'file:///Z:\somepath\MyService.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515).
Microsoft (R) .NET Framework Installation utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.

Any hints?

I know I could copy everything to C and do it from there, but it would be really nice if I could do it from a network drive.

Thanks.
Bruce
Posted

There are LOTS of problems with this idea.

First, the service has to be specified by a UNC path, not a mapped drive letter.

The service MUST be setup to execute under a user account that has access to the share the .EXE is sitting in. This is because services have to login to Windows the same as normal users do.

The service must also be setup to depend on other services, such as the TCP/IP Netbios Helper. Network services are not available immediately when Windows starts. Your service will have to wait until they are available in order to even launch it.

What if the share isn't available when Windows starts because of a service or network problem?? Your service will not start as you're added the unneccessary dependency of having network access available.

Managed code executables also run in a isolated sandbox if running from a network source. You'll have to change policies on the machine in order to get around that, like trusting executables signed with a certain certificate.


The bottom line is this is a bad idea with LOTS of dependencies that are creating more work for you than you're saving trying to run this .EXE from a central source. Just install it locally and you'll save yourself a bunch of headaches.
 
Share this answer
 
Comments
Power Puff Boy 12-Feb-14 10:32am    
Generally I agree with everything you said. Maybe I should have done some explaining why I'm trying to do this:
The service I'm trying to install is something that's built from a Visual Studio project. I'm trying to install the service from the location where it's actually built to make it easier for me to debug it. That's why I'm doing this unusual stuff.
The project is located in a version control system which gives me a network drive Z: to access my sources (guess which VCS I'm using ;-)).
I only want to install the service from Z: for my convenience. The software product itself will launch it from a local drive once it's installed on the target computer.
Dave Kreskowiak 12-Feb-14 11:06am    
It's not a valid testing environment because of the security constraints on code running from a network source.

Code a 30 delay into the OnStart method so you can attach the debugger to it on the test machine.
as the error says, there is an assembly needed by 'service.exe'. you may not have that assembly on your local machine (possibly in the GAC). use this tool to see dependencies. http://www.red-gate.com/products/dotnet-development/reflector/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900