質問

I have WCF service to be installed on windows.

Now I want to install it on a sever running windows and has installed v3.5 .net framework.

It is beside the point that the service has been written in framework 4 and therefor it will not run.

My question is Can I use "installutil" from framework 3.5 to install service and why?

=== UPDATED===

I have windows service that is running wcf inside.

役に立ちましたか?

解決

You use InstallUtil to install a Windows Service. Your WCF Service could have been developed inside a Windows Service if you followed something like the following MSDN article How to: Host a WCF Service in a Managed Windows Service.

However if the (Windows) Service is written in .NET 4 and you try to run installutil from .net 3.5 you will get the following error:

Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///C:\MyService.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded..

To install a .NET 4 (Windows) service you will need to use the .NET 4 installutil which will be available in: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installutil.exe once you have .NET 4 installed.

他のヒント

installutil is used to install the windows service not the wcf service

If you have control over building the service, just change it to target the .NET 3.5 framework and you should be able to install it.

Otherwise, if the service was built to target the .NET framework 4.0 and the server only has .NET 3.5 installed, I don't think it will run unless you explicitly override it in a config file to run under .NET 3.5 (which I wouldn't recommend).

As an aside, I always recommend that people use the WiX Toolset to write installers for Windows services, instead of using InstallUtil, because InstallUtil is a custom, non-standard Visual Studio tool to install windows services, whereas Windows Installer (MSI), the approved standard for windows installations has built-in support for installing Windows services that is tried-and-tested, and gives you more control, e.g. stopping and starting services etc.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top