{"id":21019,"date":"2024-04-09T15:41:38","date_gmt":"2024-04-09T07:41:38","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=21019"},"modified":"2024-04-09T15:41:38","modified_gmt":"2024-04-09T07:41:38","slug":"windows%e6%9c%8d%e5%8a%a1%e6%89%93%e5%8c%85%e6%93%8d%e4%bd%9c%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/21019\/","title":{"rendered":"windows\u670d\u52a1\u6253\u5305\u64cd\u4f5c\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"

Windoubuntu\u5f00\u53d1\u684c\u9762\u5e94\u7528<\/a>ws\u670d\u52a1\u662f\u4e00\u4e2a\u540e\u53f0\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u5b83\u53ef\u4ee5\u81ea\u52a8\u542f\u52a8\u3001\u505c\u6b62\uff0c\u4e0d\u9700\u8981\u7528\u6237\u5e72\u9884\u3002Windows\u670d\u52a1\u53ef\u4ee5\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fd0\u884c\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6237\u767b\u5f55\u3002Windows\u670d\u52a1\u901a\u5e38\u88ab\u7528\u4e8e\u540e\u53f0\u4efb\u52a1\uff0c\u6bd4\u5982\u76d1\u63a7\u3001\u6570\u636e\u91c7\u96c6\u3001\u81ea\u52a8\u5316\u4efb\u52a1\u7b49\u3002<\/p>\n

\u5728Windows\u4e2d\uff0c\u670d\u52a1\u662f\u7531\u670d\u52a1\u63a7\u5236\u7ba1\u7406\u5668(SCM)\u6765\u7ba1\u7406\u7684\u3002SCM\u662f\u4e00\u4e2aWindows\u64cd\u4f5c\u7cfb\u7edf\u7684\u7ec4\u4ef6\uff0c\u5b83\u8d1f\u8d23\u542f\u52a8\u3001\u505c\u6b62\u3001\u6682\u505c\u3001\u6062\u590dWindows\u670d\u52a1\u3002SCM\u8fd8\u8d1f\u7535\u8111pc\u7aef\u5f00\u53d1\u8f6f\u4ef6<\/a>\u8d23\u5904\u7406Windows\u670d\u52a1\u7684\u4e8b\u4ef6\u548c\u9519\u8bef\u3002<\/p>\n

\u6253\u5305Windows\u670d\u52a1\u7684\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n

1. \u521b\u5efa\u4e00\u4e2aWindows\u670d\u52a1\u9879\u76ee<\/p>\n

\u5728Visual Studio\u4e2d\uff0c\u9009\u62e9\u201c\u65b0\u5efa\u9879\u76ee\u201d\uff0c\u7136\u540e\u9009\u62e9\u201cWindows\u670d\u52a1\u201d\u6a21\u677f\u3002Visual<\/p>\n

<\/figure>\n<\/p>\n

Studio\u5c06\u81ea\u52a8\u521b\u5efa\u4e00\u4e2aWindows\u670d\u52a1\u9879\u76ee\u3002<\/p>\n

2. \u7f16\u5199Windows\u670d\u52a1\u4ee3\u7801<\/p>\n

\u5728Windows\u670d\u52a1\u9879\u76ee\u4e2d\uff0c\u6253\u5f00\u201cService1.cs\u201d\u6587\u4ef6\u3002\u8fd9\u662fWindows\u670d\u52a1\u7684\u4ee3\u7801\u6587\u4ef6\u3002\u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199Windows\u670d\u52a1\u7684\u4ee3\u7801\u3002\u60a8\u9700\u8981\u5b9e\u73b0\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n

OnStart\uff1a\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u5728Windows\u670d\u52a1\u542f\u52a8\u65f6\u88ab\u8c03\u7528\u3002\u5728\u8fd9\u4e2a\u65b9\u6cd5\u4e2d\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199\u4ee3\u7801\u6765\u521d\u59cb\u5316Windows\u670d\u52a1\u3002<\/p>\n

OnStop\uff1a\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u5728Windows\u670d\u52a1\u505c\u6b62\u65f6\u88ab\u8c03\u7528\u3002\u5728\u8fd9\u4e2a\u65b9\u6cd5\u4e2d\uff0c\u60a8\u53ef\u4ee5\u7f16\u5199\u4ee3\u7801\u6765\u91ca\u653eWindows\u670d\u52a1\u6240\u5360\u7528\u7684\u8d44\u6e90\u3002<\/p>\n

3. \u5b89\u88c5Windows\u670d\u52a1<\/p>\n

\u5728Windows\u670d\u52a1\u9879\u76ee\u4e2d\uff0c\u53f3\u952e\u5355\u51fb\u201cService1.cs\u201d\u6587\u4ef6\uff0c\u7136\u540e\u9009\u62e9\u201c\u6dfb\u52a0\u5b89\u88c5\u7a0b\u5e8f\u201d\u3002Visual Studio\u5c06\u81ea\u52a8\u521b\u5efa\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f\u9879\u76ee\u3002<\/p>\n

\u5728\u5b89\u88c5\u7a0b\u5e8f\u9879\u76ee\u4e2d\uff0c\u6253\u5f00\u201cProjectInstaller.cs\u201d\u6587\u4ef6\u3002\u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u8bbe\u7f6eWindows\u670d\u52a1\u7684\u5c5e\u6027\uff0c\u6bd4\u5982\u670d\u52a1\u540d\u79f0\u3001\u670d\u52a1\u63cf\u8ff0\u7b49\u7b49\u3002<\/p>\n

\u5728\u5b89\u88c5\u7a0b\u5e8f\u9879\u76ee\u4e2d\uff0c\u53f3\u952e\u5355\u51fb\u201cInstall\u201d\u6587\u4ef6\uff0c\u7136\u540e\u9009\u62e9\u201c\u751f\u6210\u201d\u3002Visual Studio\u5c06\u81ea\u52a8\u4e3a\u60a8\u751f\u6210\u4e00\u4e2a\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n

\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u5207\u6362\u5230\u5b89\u88c5\u7a0b\u5e8f\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5Windows\u670d\u52a1\uff1a<\/p>\n

installutil.exe Service1.exe<\/p>\n

4. \u542f\u52a8Windows\u670d\u52a1<\/p>\n

\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u542f\u52a8Windows\u670d\u52a1\uff1a<\/p>\n

net start Service1<\/p>\n

5. \u6d4b\u8bd5Windows\u670d\u52a1<\/p>\n

\u5728Windows\u670d\u52a1\u542f\u52a8\u540e\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7Windows\u670d\u52a1\u7ba1\u7406\u5668\u6765\u67e5\u770bWindows\u670d\u52a1\u7684\u72b6\u6001\u3002\u60a8\u8fd8\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u6d4b\u8bd5\u7a0b\u5e8f\u6765\u6d4b\u8bd5Windows\u670d\u52a1\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u6253\u5305Windows\u670d\u52a1\u662f\u4e00\u4e2a\u975e\u5e38\u7b80\u5355\u7684\u8fc7\u7a0b\u3002\u60a8\u53ea\u9700\u8981\u521b\u5efa\u4e00\u4e2aWindows\u670d\u52a1\u9879\u76ee\uff0c\u7f16\u5199Windows\u670d\u52a1\u4ee3\u7801\uff0c\u7136\u540e\u4f7f\u7528Visual Studio\u7684\u5b89\u88c5\u7a0b\u5e8f\u9879\u76ee\u6765\u5b89\u88c5Windows\u670d\u52a1\u3002\u4e00\u65e6\u5b89\u88c5\u5b8c\u6210\uff0c\u60a8\u5c31\u53ef\u4ee5\u542f\u52a8Windows\u670d\u52a1\uff0c\u5e76\u6d4b\u8bd5\u5b83\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

Windows\u670d\u52a1\u662f\u4e00\u4e2a\u540e\u53f0\u8fd0\u884c\u7684\u7a0b\u5e8f\uff0c\u5b83\u53ef\u4ee5\u81ea\u52a8\u542f\u52a8\u3001\u505c\u6b62\uff0c\u4e0d\u9700\u8981\u7528\u6237\u5e72\u9884\u3002Windows\u670d\u52a1\u53ef\u4ee5\u5728Windows\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u8fd0\u884c\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6237\u767b\u5f55\u3002Windows\u670d\u52a1\u901a\u5e38\u88ab\u7528\u4e8e\u540e\u53f0\u4efb\u52a1\uff0c\u6bd4\u5982\u76d1\u63a7\u3001<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[16496,14957,276,904,22909],"topic":[],"class_list":["post-21019","post","type-post","status-publish","format-standard","hentry","category-exekf","tag-centos7rpm","tag-window","tag-276","tag-904","tag-22909"],"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/21019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=21019"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/21019\/revisions"}],"predecessor-version":[{"id":21075,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/21019\/revisions\/21075"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=21019"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=21019"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=21019"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=21019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}