场景:
作为Windows服务运行的WCF服务.帐户是"用户".
做了什么:
我已经覆盖了projectinstaller中的OnBeforeInstall,以便能够从配置文件中设置用户名和密码.
我能做什么:
我希望能够将starttype设置为Automatic(延迟启动)
我尝试过的:
我把以下的coderow放在重写的OnBeforeInstall中
serviceInstaller1.StartType = ServiceStartMode.Automatic + 1;
想象我会把ServiceStartMode枚举变成代表自动(延迟启动),不起作用.没有尝试任何更简单的因为我找不到任何尝试.
我在网上发现了什么:
我发现自动(延迟启动)将在.NET 4中可用,但这对我现在没有帮助. MSDN 我发现可以将DelayedAutoStart添加到服务的配置键中,但如果我应该从代码中执行此操作,这感觉就像是一个黑客攻击.但也许这是目前唯一可用的解决方案?
有任何想法吗?
罗伯特佩尔松,瑞典
使用Buildroot,我正在尝试进行自定义内核构建.在构建映像并在VirtualBox环境中引导它之后,内核在GRUB阶段之后总是会发生混乱.我看到的总结:
] CPU: 0 PID: 1 ...
] Hardware name: innotek GmbH ...
] <some registers>
] Call Trace:
] [<c0a1c995>] dump_stack+...
] [<........>] panic+...
] [<........>] do_exit+...
] ...
] Kernel Offset: 0x0 from 0xc0400000 ...
] ---[ end Kernel panic - not syncing: Attempted to kill init! ...
Run Code Online (Sandbox Code Playgroud)
现在,我假设这只是我想看到的消息的尾部,但我没有办法查看它(例如:不能Shift-PageUp).发生恐慌时,屏幕上的上述文本永远不会呈现一秒钟.
我首先偶然发现了一个KernelDebuggingTricks页面,该页面指出:
在启动时减慢内核消息
... [Build]启用了以下选项的内核:
CONFIG_BOOT_PRINTK_DELAY = Y
并使用以下内核引导参数启动计算机:
boot_delay = N
我已经确认我的内核(3.16)已经使用该CONFIG_BOOT_PRINTK_DELAY选项构建,并尝试boot_delay在我的GRUB中设置为10,500和1000毫秒.即使设置了1000毫秒的延迟(并且等待了大约5分钟),整个内核恐慌日志消息也会在眨眼间喷出.
有没有人对如何查看内核恐慌的根源有任何建议?我现在唯一想到的是手动将睡眠添加到内核代码中(这是我想要避免的).
我目前正在使用Visual Studio(特别是2012 Express).我有一个接口已经定义如下:
interface IMyInterface
{
public String Data { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
如果我有一个空类:
class MyClass : IMyInterface
{
}
Run Code Online (Sandbox Code Playgroud)
我右键单击IMyInterface,我可以选择"实现接口".当我这样做时,自动生成的代码产生以下内容:
class MyClass : IMyInterface
{
public string Data
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,有没有办法可以自动生成以下内容:
public String Data
Run Code Online (Sandbox Code Playgroud)
代替:
public string Data
Run Code Online (Sandbox Code Playgroud)
?
我在我的项目中创建了一个工厂类,它允许我(理论上)为任何(支持的)给定类型创建管理器.与管理器交互允许我改变给定类型的某些属性.我面临的问题是当我尝试为泛型类型创建一个管理器时,编译器会破坏我的希望和梦想.
以下代码是我正在使用的精简版本.我尝试创建'test3Manager'的行不会编译,我试图理解为什么会这样.它下面的行显示了一个'解决方法',我试图避免.
import java.util.List;
public class GenTest {
public static void main(String[] args) {
String test1 = "";
IRandomType<String> test2 = null;
IAnotherRandomType<?> test3 = null;
IManager<String> test1Manager = Factory.createManager(test1);
IManager<IRandomType<String>> test2Manager = Factory.createManager(test2);
IManager<IAnotherRandomType<?>> test3Manager = Factory.createManager(test3); // Doesn't compile. Why?
// Work around?
IManager<?> test3ManagerTmp = Factory.createManager(test3);
IManager<IAnotherRandomType<?>> test3Manager2 = (IManager<IAnotherRandomType<?>>) test3ManagerTmp;
}
public interface IRandomType<T> {}
public interface IAnotherRandomType<T> {}
public interface IManager<T> {}
public static class Factory {
public static <T> IManager<T> createManager(T object) {
return …Run Code Online (Sandbox Code Playgroud) c# ×2
debugging ×1
generics ×1
java ×1
linux ×1
linux-kernel ×1
virtualbox ×1
wcf ×1
wildcard ×1