views:

187

answers:

2

I have a service which needs to be deployed on a clients machine.

The destination machine is 64bit. My dev machine is also 64 bit. The app is really simple, listens on a port and does some db things. It targets .net 3.5

When I deploy the Anycpu, the X64 or the X86 version, the thing won't install on the clients machine.

I checked dependencywalker and it lists: devmgr.dll ieshims.dll wer.dll

anyhow...I install visual studio 2008 on the clients machine... check out all the sources. I don't change a thing and compile. Copy the exe over to it's dest locations...and what do you know..it works.

Dependencywalker still lists the same dependency problems.

How can it be that the act of compiling it on this machine gives me a different exe?

Edit: When I say it doesn't install. I mean that installUtil gives errors:

An exception occurred during the Install phase. System.InvalidOperationException: Unable to get installer types in the C:\services \incomingnotifications\IncomingNotifications.exe assembly. at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly() at System.Configuration.Install.AssemblyInstaller.Install(IDictionary savedSt ate) at System.Configuration.Install.Installer.Install(IDictionary stateSaver) at System.Configuration.Install.TransactedInstaller.Install(IDictionary saved State) The inner exception System.Reflection.ReflectionTypeLoadException was thrown wit h the following error message: Unable to load one or more of the requested types . Retrieve the LoaderExceptions property for more information.. at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark) at System.Reflection.Module.GetTypes() at System.Configuration.Install.AssemblyInstaller.GetInstallerTypes(Assembly assem) at System.Configuration.Install.AssemblyInstaller.InitializeFromAssembly()

also...before compiling with visual studio, I checked that the service would still not install. After compiling it did work.

Edit2: Compiling it again on the devmachine and sending the binary over, results in the same errors. Compiling locally gives me an exe which works

+1  A: 

It's not very clear what exactly your problem is, as you say it won't install on the machine. what do you mean? the install fails? or are you just copying it over and trying to run it? do you get any error messages?

did you install the service? or is this done as part of the build? this might explain why copying it to the machine doesn't work but building it does... Does the exe compiled on the dev machine work once you have installed VS on the new machine?

I would check that your target machine has the correct version of .net on it first, as installing VS would put that on there if it wasn't.

I would use a tool like procmon to see what happens when the service is started, to check that it is not some dll that is missing.

Some more info might help get to an answer a bit quicker...

EDIT:

After your edit with the exception I did a bit of googling and came across this thread which suggests a few options, but the main one which seemed to cure it for some (assuming that you do not have dependencies which cannot be resolved) is that you are not running the install util as an administrator:

to quote from the thread:

You're running into 'standard user'. I'm guessing that you may be running under an account that is a member of the local admin group, but with Vista UAC enabled even admins run as standard user until they run an application that makes a explicit admin request - at which point you typically get a admin elevation prompt. InstallUtil.exe isn't marked as explicitly requiring admin so this is failing.

Either create a cmd script that runs InstallUtil youService.exe and set the script to require admin or do a 'runas /user:Administrator cmd.exe' and run InstallUtil from there.

and if that is not the issue then another guy suggests:

I found out that the install works when I use the InstallUtil.exe in the 32-bit framework, but generates the System.Reflection.ReflectionTypeLoadException when running the InstallUtil.exe in the 64-bit framework. Is this a setting I need to put in my project or a structure I'm including that is not supported by 64-bit? (although I thought it was backwards compatible).

Not sure if either of these will help, but you never know...

Sam Holder
I updated my question a bit with your comments
Toad
I updated the answer. hopefully might contain some useful info...
Sam Holder
@sam holder: thanks. Unfortunately the file does install from the same command prompt, with the same installutil when the file is locally build and copied to that location. When I get the exe from the dev it doesn't. So elevated trust doesn't seem like an option
Toad
A: 

Starting with the .NET Framework version 2.0, the 32-bit version of the common language runtime (CLR) continues to ship with only the 32-bit version of the Installer tool, but the 64-bit version of the CLR ships with both a 32-bit and a 64-bit version of the Installer tool. When using the 64-bit CLR, use the 32-bit Installer tool to install 32-bit assemblies, and the 64-bit Installer tool to install 64-bit and Microsoft intermediate language assemblies. Otherwise, both versions of the Installer tool behave the same.

Source

RandomNoob
I checked it... When trying the other installutil i get: BadImageException. An attempt was made to load a program with an incorrect format". This is a different error than I got, so I'm using the correct installutil
Toad
If you have a bad image, you could try using the CorFlags tool (http://msdn.microsoft.com/en-us/library/ms164699%28VS.80%29.aspx) to ensure your assembly's are set as 32bit even if they are running on a 64 bit machine. I have had to do this in the past with 3rd party products (not services though) when we moved the .NET based apps from a 32bit server to a 64 bit server
RandomNoob