惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 最新话题
G
Google Developers Blog
J
Java Code Geeks
The GitHub Blog
The GitHub Blog
F
Full Disclosure
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
Help Net Security
Help Net Security
The Hacker News
The Hacker News
IT之家
IT之家
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V
Visual Studio Blog
博客园 - 聂微东
Hacker News: Ask HN
Hacker News: Ask HN
H
Hacker News: Front Page
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Last Week in AI
Last Week in AI
Schneier on Security
Schneier on Security
N
News and Events Feed by Topic
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
Google DeepMind News
Google DeepMind News
Cloudbric
Cloudbric
N
News | PayPal Newsroom
A
About on SuperTechFans
S
Schneier on Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Hugging Face - Blog
Hugging Face - Blog
M
MIT News - Artificial intelligence
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
雷峰网
雷峰网
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
K
Kaspersky official blog
The Cloudflare Blog
I
Intezer

博客园 - 无之无

别了博客园! 即将没落的博客园?!!! SQL里ROWCOUNT的使用 阿里云的背后故事(希望别被关了) LINQ:是BUG还是~~~ 集合代理类的实现 WPF对绑定到数据的树初始化选择项 SilverLight中的数据绑定 [请教]关于 .NET 应用的几个问题请教!!!( 如何解决 自定义控件 构造被设计器删除? 遭遇品牌电脑的尴尬 面对VS2005,我遇到了BUG? FOREACH的遍历 Windows Form的初始化大小记录处理问题 怪异的Windows Form事件 MDI窗体关闭问题解决一例 .Net再发行包与强名称 托管与非托管的混合编程问题 关于WMI
该死的微软,该死的文档,该死的ExecuteCommand
无之无 · 2006-09-15 · via 博客园 - 无之无

写了个WinService,想通过控制界面对Service进行STOP、START之外的其它控制,比如执行相关命令。

在使用ServiceController中,发现只有一个ExecuteCommand方法可以进行控制处理,而该死的ExecuteCommand只有一个int类型的参数可传递,该死!!!

int就int吧,本人把32位int进行分段处理以实现传递复杂命令的需求。该死的ExecuteCommand不干了,报告以下错误:

System.InvalidOperationException: 无法控制计算机“.”上的 MyWinService 服务。 ---> System.ComponentModel.Win32Exception: 参数不正确。
   --- 内部异常堆栈跟踪的结尾 ---
   在 System.ServiceProcess.ServiceController.ExecuteCommand(Int32 command)

翻阅文档,晕呀,明明说了是int类型呀,我传递的也确定是int类型呀,怎么就参数不正确了呢?

嘿嘿,本人猜测是否int类型的参数过大,于是对参数从-100到+100都进行了遍历测试,结果还是不一样,狂头痛。

幸好有同事同时在搜索资料,答曰:参数的值不能小于128,也不能大于255。

再次狂晕!!!

该死的微软,该死的文档,该死的ExecuteCommand