64位的windows服务安装问题

需要使用64位的安装exe文件才可以。

@echo off
C:WindowsMicrosoft.NETFramework64v4.0.30319InstallUtil.exe -i "MqWindowService.exe"

@echo off
C:WINDOWSMicrosoft.NetFramework64v4.0.30319InstallUtil.exe -u "MqWindowService.exe"

ps,关于log4net的问题

在windows服务中如果要使用log4net,可以在程序入口里加入以下代码,并且设置配置文件为内容文件,复制到bin目录里。

string assemblyFilePath = Assembly.GetExecutingAssembly().Location;
string assemblyDirPath = Path.GetDirectoryName(assemblyFilePath);
string configFilePath = assemblyDirPath + "\log4net.config";
XmlConfigurator.ConfigureAndWatch(new FileInfo(configFilePath));

原文地址:https://www.cnblogs.com/xyfy/p/6416049.html