Привет! Мне нужна возможность вызова веб-службы из установщика WIX, и у меня возникло несколько проблем.
Я понимаю, что мне нужно добавить настраиваемое действие, которое будет взаимодействовать со службой:
[CustomAction]
public static ActionResult Activate(Session session)
{
ActionResult result = ActionResult.Success;
try
{
session.Log("Begin Activate");
Debugger.Launch();
//session["ACTIVATIONSERVICEURL"] = "http://localhost/ActivationService/V1/ActivationService.svc";
//session["ACTIVATIONUSERNAME"] = "james";
//session["ACTIVATIONPASSWORD"] = "Password123";
//string endpoint = session["ACTIVATIONSERVICEURL"];
//string username = session["ACTIVATIONUSERNAME"];
//string password = session["ACTIVATIONPASSWORD"];
//using (ActivationServiceClient client = new ActivationServiceClient("ASC", endpoint))
//{
// client.ClientCredentials.UserName.UserName = username;
// client.ClientCredentials.UserName.Password = password;
// Guid userToken = client.Activate();
// session["USERTOKEN"] = userToken.ToString();
//}
session.Log("Finishing Activate");
}
catch (Exception ex)
{
session.Log("Exception caught: {0}", ex);
result = ActionResult.Failure;
}
return result;
}
Мне удалось вызвать это действие, но у меня возникли проблемы с диалоговым окном «Для завершения установки требуется DLL».Похоже, что он вызывает службу в InstallFinalize.
<!-- Custom action for calling remote web service-->
<CustomAction Id="CallActivationService"
BinaryKey="ActivationServiceCustomAction"
DllEntry="Activate"
Return="check" />
<Binary Id="ActivationServiceCustomAction"
SourceFile="$(var.SolutionDir)\Application\ExternalAssemblies\MyCompany.Application.ActivationService.CA.dll" />
<Custom Action="CallActivationService" Before="InstallFinalize">Not Installed OR Installed</Custom>
Журнал просто возвращает значение 3:
MSI (s) (54:D0) [12:26:29:726]: Doing action: CallActivationService
Action 12:26:29: CallActivationService.
Action start 12:26:29: CallActivationService.
MSI (s) (54:D0) [12:26:29:726]: Creating MSIHANDLE (32) of type 790542 for thread 1232
MSI (s) (54:4C) [12:26:29:726]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI1BE8.tmp, Entrypoint: Activate
MSI (s) (54:4C) [12:26:29:773]: Closing MSIHANDLE (32) of type 790542 for thread 1232
MSI (s) (54:D0) [12:26:29:773]: Note: 1: 1723 2: CallActivationService 3: Activate 4: C:\WINDOWS\Installer\MSI1BE8.tmp
Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action CallActivationService, entry: Activate, library: C:\WINDOWS\Installer\MSI1BE8.tmp
MSI (s) (54:D0) [12:26:56:679]: Product: My AppClient Application -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action CallActivationService, entry: Activate, library: C:\WINDOWS\Installer\MSI1BE8.tmp
Action ended 12:26:56: CallActivationService. Return value 3.
Action ended 12:26:56: INSTALL. Return value 3.
Cheers, J