Bra*_*son 35 c# windows-services
我正在尝试部署我写的服务.这是InstallLog文件:
Installing assembly 'c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe'.
Affected parameters are:
logtoconsole =
assemblypath = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe
logfile = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.InstallLog
Installing service TweetLinkService...
Creating EventLog source TweetLinkService in log Application...
Rolling back assembly 'c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe'.
Affected parameters are:
logtoconsole =
assemblypath = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.exe
logfile = c:\Users\brwatson\Development\Projects\TweetLinks\TweetLinkQueue\bin\Debug\TweetLinkQueue.InstallLog
Restoring event log to previous state for source TweetLinkService.
An exception occurred during the Rollback phase of the System.Diagnostics.EventLogInstaller installer.
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.
An exception occurred during the Rollback phase of the installation. This exception will be ignored and the rollback will continue. However, the machine might not fully revert to its initial state after the rollback is complete.
Run Code Online (Sandbox Code Playgroud)
如你所见,它不起作用.我不知道该如何继续,并且已经与Bing和Google发生冲突.我已经为ServiceProcessInstaller1设置了Account to LocalSystem.代码编译得很好,但现在我想运行这个东西......任何想法?我是我的盒子的管理员,我正在运行命令:
InstallUtil TweetLinkQueue.exe
来自VS2008管理控制台.
UPDATED with/ShowCallStack选项
调用堆栈
An exception occurred during the Install phase.
System.Security.SecurityException: The source was not found, but some or all eve
nt logs could not be searched. Inaccessible logs: Security.
at System.Diagnostics.EventLog.FindSourceRegistration(String source, String m
achineName, Boolean readOnly)
at System.Diagnostics.EventLog.SourceExists(String source, String machineName
)
at System.Diagnostics.EventLogInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.ServiceProcess.ServiceInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
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)
Run Code Online (Sandbox Code Playgroud)
这是构造函数:
public TweetLinkService()
{
InitializeComponent();
if (!EventLog.SourceExists("TweetLinkQueue"))
{
EventLog.CreateEventSource("TweetLinkQueue", "Log");
TweetLinksLog.Source = "TweetLinkQueue";
TweetLinksLog.Log = "Log";
TweetLinksLog.WriteEntry("Log Created!");
}
}
Run Code Online (Sandbox Code Playgroud)
使用ENtry Point更新:
namespace TweetLinkQueue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new TweetLinkService()
};
ServiceBase.Run(ServicesToRun);
}
}
}
Run Code Online (Sandbox Code Playgroud)
小智 118
我只是遇到了这个问题,因为我没有以管理员身份运行我的visual studio命令提示符.
小智 8
为了解决这个问题,用鼠标右键单击您的Visual Studio 2008的命令提示符,然后单击以管理员身份运行,那么你喜欢installutil运行C您的命令:\ mcWebService\BIN \调试\ mcWebService.exe然后它会告诉你成功的消息.希望这将解决您的解决方案.