从WIX调用web服务

从WIX调用web服务,wix,custom-action,wix3.5,Wix,Custom Action,Wix3.5,嗨,我需要能够从WIX安装程序调用web服务,我有一些问题 我意识到我需要添加一个与服务通信的自定义操作: [CustomAction] public static ActionResult Activate(Session session) { ActionResult result = ActionResult.Success; try { session.Log("Begin Activate");

嗨,我需要能够从WIX安装程序调用web服务,我有一些问题

我意识到我需要添加一个与服务通信的自定义操作:

 [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>
干杯,
J

找到了答案。问题是在代理周围使用块来隐藏服务抛出的绑定协议异常(在其他设置问题之后)。

解决了这个问题。问题是在代理周围使用块来隐藏服务抛出的绑定协议异常(在其他设置问题之后)

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.