服务结构设置入口点 [英] Service Fabric SetupEntryPoint

查看:39
本文介绍了服务结构设置入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Guest Executable,它需要访问共享驱动器(Azure文件).我的来宾可执行文件是在ServiceManifest.xml中设置的.我尝试添加一个以启动具有网络使用命令的"mysetup.bat"文件,该命令用于建立与我的Azure文件共享的连接.但是,我收到以下模糊的错误:

I have a Guest Executable that needs to access a shared drive (Azure Files). My guest executable is setup in of the ServiceManifest.xml. I've tried adding a to launch a "mysetup.bat" file that has the NET USE command that setups up the connection with my Azure Files share. However, I'm getting the following vague errors:

错误事件:SourceId ='System.Hosting', Property ='CodePackageActivation:Code:SetupEntryPoint'.有一个 激活CodePackage时发生错误.服务主机终止 退出代码:1

Error event: SourceId='System.Hosting', Property='CodePackageActivation:Code:SetupEntryPoint'. There was an error during CodePackage activation.The service host terminated with exit code:1

有人尝试过吗?或至少有关于如何获得比超级有用的退出代码:1"更多的信息的提示?

Anybody tried this before? Or at least any tips on how to get more information than the super helpful "Exit code:1"?

推荐答案

在我的情况下,我解决了错误:"CodePackageActivation:Code:SetupEntryPoint激活CodePackage时出错.服务主机终止,退出代码为:1"

In my case I solved the error: "CodePackageActivation:Code:SetupEntryPoint There was an error during CodePackage activation.The service host terminated with exit code:1"

将我的安装脚本移动到ps1文件,然后从 MySetup.bat

by moving my setup script to a ps1 file and executing it from the MySetup.bat

所以我在.bat和.ps1文件中以以下内容结束了.

So I ended it up with the following in my .bat and .ps1 files.

  1. 在我的 MySetup.bat 中(您在服务清单中引用的那个):

powershell.exe -ExecutionPolicy绕过-命令.\ MySetup.ps1"

powershell.exe -ExecutionPolicy Bypass -Command ".\MySetup.ps1"

  1. 在我的 MySetup.ps1 中(在此处添加您自己的PowerShell脚本):

netsh http add urlacl url = http://erick1.com:80/ user ="NT AUTHORITY \ NETWORK SERVICE"

netsh http add urlacl url=http://erick1.com:80/ user="NT AUTHORITY\NETWORK SERVICE"

如何调试:

将虚拟机远程桌面,然后转到"D:\ SvcFab_App [此处的服务类型名称] \ log"并检查.err和.out文件.不要忘记添加到您的服务清单中.整个部分将是:

Remote Desktop your Virtual Machine and go to "D:\SvcFab_App[YOUR SERVCE TYPE NAME HERE]\log" and check the .err and .out files. Don't forget to add to your service manifest.. the entire section would be:

<SetupEntryPoint>
  <ExeHost>
    <Program>MySetup.bat</Program>
    <WorkingFolder>CodePackage</WorkingFolder>
    <ConsoleRedirection FileRetentionCount="10"/>
  </ExeHost>
</SetupEntryPoint>

最后一件事:就我而言,.bat文件中有一个特殊字符,在Visual Studio中不可见,并且我的设置失败了……我只能通过阅读日志来发现它(如上所述) .不要担心日志,在这种情况下,通常是一行.

One last thing: In my case I had a special char in the .bat file that was not visible in Visual Studio and my setup was failing... I was only able to discovery it by reading the logs ( described above ). Don't be afraid of logs, it's usually one line in this case.

谢谢

这篇关于服务结构设置入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆