Tôi đã xem một số câu hỏi liên quan đến stackoverflow liên quan đến vấn đề này, nhưng không có câu nào trong số chúng dường như giải quyết được hành vi cụ thể mà tôi đang quan sát.Dịch vụ Windows không dừng và không bị xóa khi gỡ cài đặt (Wix)
Tôi có Dịch vụ Windows được định nghĩa như sau trong tệp Wix 3.0 .wxs.
<Component Id='Service' Guid='3c658a54-b236-11e0-bbf6-039615e482ae' >
<File Id='ServiceEXE' Name='m_agent_service.exe'
Vital='yes' Source='..\m_agent_service.exe'
KeyPath='yes' />
<ServiceInstall Id='MerakiServiceInstall'
Vital='yes'
Name='MerakiPCCAgent' DisplayName='Meraki Client Insight Agent $(env.VERSION)' Description="Meraki Client Insight Monitoring and Management Service"
Type='ownProcess' Interactive='no' Start='auto' ErrorControl='normal'>
</ServiceInstall>
<ServiceControl Id='MerakiServiceControl'
Name='MerakiPCCAgent'
Start='install' Stop='both' Remove='uninstall'
Wait='yes' />
</Component>
Khi tôi cài đặt .MSI, dịch vụ được cài đặt và chạy. Tuyệt quá.
Khi tôi gỡ cài đặt (bằng cách chạy msiexec/x hoặc sử dụng phần mềm Thêm/loại bỏ khỏi Pa-nen điều khiển), dịch vụ tiếp tục chạy và không bị xóa. Trong thực tế, nhật ký của bản thân dịch vụ cho tôi biết rằng không có mã tắt dịch vụ nào được gọi. (Khi tôi sử dụng "dừng sc", ví dụ, tôi làm thấy mã dịch vụ tắt máy chạy sạch.)
Dưới đây là một số bộ phận nổi bật từ msiexec/x gỡ bỏ cài đặt đăng nhập:
MSI (s) (14:04) [11:33:54:692]: 1 application(s) had been reported to have files
in use.
Info 1603. The file C:\Program Files\Meraki\PCC Agent 1.0.67\m_agent_service.exe
is being held in use by the following process: Name: m_agent_service, Id: 3120,
Window Title: '(not determined yet)'. Close that application and retry.
MSI (c) (40:78) [11:33:54:692]: File In Use: -m_agent_service- Window could not
be found. Process ID: 3120
MSI (c) (40:78) [11:33:54:692]: No window with title could be found for FilesInUse
[...]
Action start 11:33:57: UnpublishFeatures.
MSI (s) (14:04) [11:33:57:379]: Doing action: StopServices
MSI (s) (14:04) [11:33:57:379]: Note: 1: 2205 2: 3: ActionText
Action ended 11:33:57: UnpublishFeatures. Return value 1.
Action start 11:33:57: StopServices.
MSI (s) (14:04) [11:33:57:379]: Doing action: DeleteServices
MSI (s) (14:04) [11:33:57:379]: Note: 1: 2205 2: 3: ActionText
Action ended 11:33:57: StopServices. Return value 1.
Action start 11:33:57: DeleteServices.
MSI (s) (14:04) [11:33:57:379]: Doing action: RemoveFiles
[...]
MSI (s) (14:04) [11:33:57:645]: Product: Meraki Client Insight Agent -- Removal
completed successfully.
MSI (s) (14:04) [11:33:57:645]: Windows Installer removed the product. Product N
ame: Meraki Client Insight Agent. Product Version: 1.0.67. Product Language: 103
3. Removal success or error status: 0.
Dịch vụ bạn đang tạo có phụ thuộc vào một số tập tin hoặc hội đồng khác không? Nếu có, thì bạn cần lấy id tiến trình của dịch vụ và sau đó giết quá trình. sau đó bạn có thể gỡ cài đặt dịch vụ –