从 WIX 调用 Web 服务
您好,我需要能够从 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>
日志只返回值 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.
干杯, J
Hi I need to be able to call a web service from a WIX installer and I'm having a few issues.
I realise I need to add a custom action which will communicate with the service:
[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;
}
I've managed to call this action but I'm having issues with a dialog "A DLL is required for this installation to complete". It looks to be calling the service under 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>
The log just returns value 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
想通了。问题与在代理周围使用块隐藏服务抛出的绑定协议异常(在其他设置问题之后)有关。
Figured it out. Issue was to do with using blocks around the proxy hiding the binding protocal exception the service was throwing (after other setup issues).