Ok, I found the problem... I applied the same PostSharp aspect twice to a method. So I had Method1
and Method2
, both have the [MyException]
aspect applied. Method1
calls Method2
so the aspect is 'applied' twice, which didn't go down well with the Service Installer. I removed the aspect from Method2
and all worked fine!
InstallUtil fails on installing custom Windows Service
-
01-06-2022 - |
Вопрос
I'm busy writing a custom Windows Services to handle MSMQ messages on a server, but the installation (using InstallUtil) keeps failing with the following error:
"System.InvalidOperationException: Unable to get installer types in the 'x'.exe assembly. The inner exception System.Reflection.ReflectionTypeLoadException was thrown with the following error message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information."
I am using 3 of my own assemblies in the service. All of them are set to 'Copy Local' and all other referenced assemblies are in the GAC. I have verified that all other referenced assemblies not in the GAC are in the the folder containing my services' .exe file.
I have also tried signing my assemblies (if that is worth anything...)
I have also looked around on Google, but in most cases the problem was either solved via a service pack, or installation of some proprietary software, which obviously solved the missing dependency issue.
I wrote a simple POC service, without referencing any 'outside' assemblies which worked fine...
I'm developing and testing on a Windows 7 machine.
Any ideas? Thanks!
EDIT: Ok weird... I was using PostSharp for exception handling and logging... I removed the references to PostSharp and my aspects, and it installed with no problem... o_O Is there any reason why something like PostSharp will not play well with Windows Services?
Решение 3
Другие советы
Without the installer, have you tried registering your service with all dependent assemblies? were you successfully able to register? If this has worked, then - Is your service registration action is post install complete action in your installation authoring steps?
Sorry fo my english. I worked 2 days on this problem and i found that installutil works only if installutil and service and dependencies files in one directory.
installutil service -> works fine installutil ServicePath\service -> dont work if dependencies in ServicePath directory.