我在大约十分之一的系统上使用 WiX 进行重大升级时发现间歇性问题。 Windows 服务在卸载旧版本产品时被删除,然后在安装新版本产品时安装并启动。但是 1 或 2 秒后,新版本的 Windows 服务被卸载。我认为这可能违反了组件规则或文件版本控制规则,例如 this question ,但我没有在 WiX 脚本中看到问题。我没有更改组件 GUID 或引用其他组件中的资源,Windows 服务 exe 将从版本 1.4.3 升级到 1.4.7。
升级失败后,我可以卸载新版产品,安装老版产品,然后大升级到新版产品,没有任何问题。在第一次初始升级失败后,所有其他升级都可以工作。任何帮助将不胜感激。
代码是:
<RemoveExistingProducts After="InstallExecute" />
<Component Id="ProgFiles" Guid="C692BAF6-17DB-4E8B-8225-9F0614080B16" Shared="no" Permanent="no">
<ServiceInstall Id="InstallWindowsService"
Name="$(var.WindowsServiceName)"
DisplayName="[WINDOWS_SERVICE_DISPLAY_NAME]"
Type="ownProcess"
Start="auto"
ErrorControl="critical"
Description="$(var.AppDescription)">
<ServiceConfig Id="WindowsServiceConfig"
DelayedAutoStart="yes"
OnInstall="yes"
OnReinstall="yes"/>
</ServiceInstall>
<File Id='_04' DiskId='1' Name='Service.exe' Source='..\bin\$(var.BinariesToUse)\Service.exe' KeyPath='yes'/>
</Component>
<Component Id="ReleaseInstallRegEntries" Guid="5AB1B28B-C884-4230-9275-4095DDD06085" Shared="no" Permanent="no">
<ServiceControl Id="WindowsServiceControl_USER"
Name="$(var.WindowsServiceName)"
Stop="both"
Start="install"
Remove="uninstall"
Wait="yes" />
</Component>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="1033"
Property="NEWERPRODUCTFOUND" />
<UpgradeVersion Minimum="0.0.0"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="UPGRADEFOUND" />
</Upgrade>
从 here 下载的整个 msi 安装日志
msi 安装日志:
MSI (s) (60:74) [12:09:04:691]: Doing action: RemoveExistingProducts
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2: 3: ActionText
Action ended 12:09:04: PublishProduct. Return value 1.
MSI (s) (60:74) [12:09:04:691]: Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall
Action start 12:09:04: RemoveExistingProducts.
MSI (s) (60:74) [12:09:04:691]: Doing action: CleanUpgradeFolder
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2: 3: ActionText
Action ended 12:09:04: RemoveExistingProducts. Return value 0.
Action start 12:09:04: CleanUpgradeFolder.
MSI (s) (60:74) [12:09:04:691]: Skipping action: WixFailWhenDeferred (condition is false)
MSI (s) (60:74) [12:09:04:691]: Doing action: InstallFinalize
MSI (s) (60:74) [12:09:04:691]: Note: 1: 2205 2: 3: ActionText
Action ended 12:09:04: CleanUpgradeFolder. Return value 1.
MSI (s) (60:74) [12:09:04:691]: Running Script: C:\Windows\Installer\MSI4518.tmp
MSI (s) (60:74) [12:09:04:691]: PROPERTY CHANGE: Adding UpdateStarted property. Its value is '1'.
MSI (s) (60:74) [12:09:04:769]: Note: 1: 2265 2: 3: -2147287035
MSI (s) (60:74) [12:09:04:769]: Machine policy value 'DisableRollback' is 0
MSI (s) (60:74) [12:09:04:769]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1225810211,LangId=1033,Platform=0,ScriptType=1,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=1)
Action start 12:09:04: InstallFinalize.
MSI (s) (60:74) [12:09:04:769]: Executing op: ProductInfo(ProductKey={2BFA1207-9A98-4D55-9182-5C433ED6A55A},ProductName=Dell Customer Connect,PackageName=OTBSurvey.1.4.3.0.msi,Language=1033,Version=17039363,Assignment=1,ObsoleteArg=0,ProductIcon=dnd.ico,,PackageCode={11C5914C-B010-41D1-B920-D4C97AC61404},,,InstanceType=0,LUASetting=0,RemoteURTInstalls=0,ProductDeploymentFlags=3)
MSI (s) (60:74) [12:09:04:769]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (60:74) [12:09:04:769]: Executing op: DialogInfo(Type=1,Argument=Dell Customer Connect)
MSI (s) (60:74) [12:09:04:769]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (60:74) [12:09:04:769]: Executing op: SetBaseline(Baseline=0,)
MSI (s) (60:74) [12:09:04:769]: Executing op: SetBaseline(Baseline=1,)
MSI (s) (60:74) [12:09:04:769]: Executing op: ActionStart(Name=InstallInitialize,,)
MSI (s) (60:74) [12:09:04:785]: Executing op: ProductUnregister(UpgradeCode={29D88272-5B32-4441-B6F3-568230D61331})
MSI (s) (60:74) [12:09:04:785]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Transforms 3: 2
MSI (s) (60:74) [12:09:04:785]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Transforms 3: 2
MSI (s) (60:74) [12:09:04:785]: Scheduling file 'C:\Windows\Installer\74bb8.msi' for deletion during post-install cleanup (not post-reboot).
MSI (s) (60:74) [12:09:04:800]: Note: 1: 1402 2: UNKNOWN\Products\7021AFB289A955D41928C534E36D5AA5\Usage 3: 2
MSI (s) (60:74) [12:09:04:800]: Executing op: ProductCPDisplayInfoUnregister()
MSI (s) (60:74) [12:09:04:800]: Executing op: ProductUnpublish(PackageKey={11C5914C-B010-41D1-B920-D4C97AC61404})
MSI (s) (60:74) [12:09:04:800]: Using cached product context: machine assigned for product: 7021AFB289A955D41928C534E36D5AA5
MSI (s) (60:74) [12:09:04:816]: Executing op: UpgradeCodeUnpublish(UpgradeCode={29D88272-5B32-4441-B6F3-568230D61331})
MSI (s) (60:74) [12:09:04:816]: Executing op: IconRemove(Icon=dnd.ico,)
MSI (s) (60:74) [12:09:04:816]: Scheduling file 'C:\Windows\Installer\{2BFA1207-9A98-4D55-9182-5C433ED6A55A}\dnd.ico' for deletion during post-install cleanup (not post-reboot).
MSI (s) (60:74) [12:09:04:816]: Executing op: ProductUnpublishClient(,,)
MSI (s) (60:74) [12:09:04:816]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5 3: 2
MSI (s) (60:74) [12:09:04:816]: Executing op: SourceListUnpublish(,)
MSI (s) (60:74) [12:09:04:816]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5\SourceList 3: 2
MSI (s) (60:74) [12:09:04:816]: Executing op: ActionStart(Name=ProcessComponents,Description=Updating component registration,)
MSI (s) (60:74) [12:09:04:816]: Executing op: ProgressTotal(Total=12,Type=1,ByteEquivalent=24000)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={F48BF778-F931-42C4-9D18-BE9A27E1D9F9},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={F48BF778-F931-42C4-9D18-BE9A27E1D9F9},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={9A35F430-54AA-4FD6-9936-DD72910CF898},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={9A35F430-54AA-4FD6-9936-DD72910CF898},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={DAA28A1B-1403-49C5-966E-E8C1989061D0},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={DAA28A1B-1403-49C5-966E-E8C1989061D0},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={4F8B0F06-392A-4963-8A99-B32F436F802D},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={4F8B0F06-392A-4963-8A99-B32F436F802D},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={1FF47611-4ABF-4A40-8278-133E73DF0461},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={1FF47611-4ABF-4A40-8278-133E73DF0461},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={A2612202-F609-4C42-8FBC-2BE733A3D1FB},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={A2612202-F609-4C42-8FBC-2BE733A3D1FB},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={9817EEDA-E4CC-4B5A-B97D-F9CF0C7DF493},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={9817EEDA-E4CC-4B5A-B97D-F9CF0C7DF493},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={23FB7BF8-C385-4FE2-8A3F-AC4D7BE23CAF},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={23FB7BF8-C385-4FE2-8A3F-AC4D7BE23CAF},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:816]: Executing op: UnregisterSharedComponentProvider(Component={350DEE79-78D9-46B6-8442-90A9299C8DDD},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:816]: Executing op: ComponentUnregister(ComponentId={350DEE79-78D9-46B6-8442-90A9299C8DDD},,BinaryType=0,)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={8B227A34-6400-433B-84BD-F4BA9CC26E75},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={8B227A34-6400-433B-84BD-F4BA9CC26E75},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={0DE95021-65AC-47DD-9158-A931C0363522},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={0DE95021-65AC-47DD-9158-A931C0363522},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: UnregisterSharedComponentProvider(Component={CB46CF46-8580-4739-84BE-A7F8005B88AA},ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A})
MSI (s) (60:74) [12:09:04:832]: Executing op: ComponentUnregister(ComponentId={CB46CF46-8580-4739-84BE-A7F8005B88AA},,BinaryType=0,PreviouslyPinned=1)
MSI (s) (60:74) [12:09:04:832]: Executing op: ActionStart(Name=UnpublishFeatures,Description=Unpublishing Product Features,Template=Feature: [1])
MSI (s) (60:74) [12:09:04:832]: Executing op: FeatureUnpublish(Feature=MainFeature,,Absent=2,Component=oOhZwZc(O93_IgYZf`AysfrWYMS(aAH`zvLW+y1YKOr=oNHBe?(lECg)&h{kng%XA4jrY?**1D3.j'^2of{=-h$Or?u3qy72QN3GP8%4]bMHS@-6DAsx2KxyL5%tX%L]6@$$_pk6?{VWgq~W.N@IbAAYxz@snACa!~H'5xXlf=$O@R_YxY5p*P!fTand[9pcL*el).hM7d&P'`i=+?B@dz3w@T~-Pn@DjY@kt=bq}vxbrim_)
MSI (s) (60:74) [12:09:04:832]: Note: 1: 1402 2: UNKNOWN\Installer\Features\7021AFB289A955D41928C534E36D5AA5 3: 2
MSI (s) (60:74) [12:09:04:832]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1])
MSI (s) (60:74) [12:09:04:832]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (60:74) [12:09:04:832]: Executing op: ServiceControl(,Name=Dell Customer Connect,Action=2,Wait=1,)
MSI (s) (60:74) [12:09:19:681]: Executing op: ActionStart(Name=DeleteServices,Description=Deleting services,Template=Service: [1])
MSI (s) (60:74) [12:09:19:681]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (60:74) [12:09:19:681]: Executing op: ServiceControl(,Name=Dell Customer Connect,Action=8,Wait=1,)
MSI (s) (60:74) [12:09:19:681]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1], Directory: [9], Size: [6])
MSI (s) (60:74) [12:09:19:681]: Executing op: RemoveBaseline(ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A},ProductVersion=1.4.3)
MSI (s) (60:74) [12:09:19:681]: Verifying accessibility of file: _01
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _04
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _05
MSI (s) (60:74) [12:09:19:696]: Verifying accessibility of file: _06
MSI (s) (60:74) [12:09:19:712]: Verifying accessibility of file: _16
MSI (s) (60:74) [12:09:19:712]: Verifying accessibility of file: _17
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _19
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _20
MSI (s) (60:74) [12:09:19:728]: Verifying accessibility of file: _21
MSI (s) (60:74) [12:09:19:743]: Verifying accessibility of file: _22
MSI (s) (60:74) [12:09:19:743]: Verifying accessibility of file: _40
MSI (s) (60:74) [12:09:19:771]: Verifying accessibility of file: _41
MSI (s) (60:74) [12:09:19:786]: Verifying accessibility of file: _42
MSI (s) (60:74) [12:09:19:786]: Verifying accessibility of file: _43
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _44
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _77
MSI (s) (60:74) [12:09:19:802]: Verifying accessibility of file: _78
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _79
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _80
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _81
MSI (s) (60:74) [12:09:19:818]: Verifying accessibility of file: _82
MSI (s) (60:74) [12:09:19:833]: Note: 1: 2318 2: C:\Windows\Installer\$PatchCache$\Managed\7021AFB289A955D41928C534E36D5AA5\CacheSize.txt
MSI (s) (60:74) [12:09:19:833]: Executing op: RemoveBaseline(ProductCode={2BFA1207-9A98-4D55-9182-5C433ED6A55A},)
MSI (s) (60:74) [12:09:19:833]: Verifying accessibility of file: CacheSize.txt
MSI (s) (60:74) [12:09:19:833]: Executing op: ActionStart(Name=PublishProduct,Description=Publishing product information,)
MSI (s) (60:74) [12:09:19:833]: Executing op: CleanupConfigData()
MSI (s) (60:74) [12:09:19:833]: Executing op: RegisterPatchOrder(Continue=0,SequenceType=0,Remove=1)
MSI (s) (60:74) [12:09:19:833]: Note: 1: 1402 2: UNKNOWN\Installer\Products\7021AFB289A955D41928C534E36D5AA5\Patches 3: 2
MSI (s) (60:74) [12:09:19:833]: Executing op: RegisterPatchOrder(Continue=0,SequenceType=1,Remove=1)
MSI (s) (60:74) [12:09:19:833]: Executing op: CleanupConfigData(RemovingProduct=1)
MSI (s) (60:74) [12:09:19:833]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\7021AFB289A955D41928C534E36D5AA5\Patches 3: 2
MSI (s) (60:74) [12:09:19:833]: Executing op: ActionStart(Name=CleanUpgradeFolder,,)
MSI (s) (60:74) [12:09:19:833]: Executing op: CustomActionSchedule(Action=CleanUpgradeFolder,ActionType=3110,Source='MsgBox Session.Property("CleanUpgradeFolder")
'delete the settings file:
Set filesys = CreateObject("Scripting.FileSystemObject")
sSettingsFilePath = "C:\ProgramData\Dell\OTBS\OTBSService.State.settings"
If filesys.FileExists(sSettingsFilePath) Then
filesys.DeleteFile sSettingsFilePath
End If,,)
MSI (s) (60:74) [12:09:19:833]: Creating MSIHANDLE (7) of type 790536 for thread 884
MSI (s) (60:78) [12:09:19:833]: Creating MSIHANDLE (8) of type 0 for thread 1912
MSI (s) (60:78) [12:09:19:861]: Closing MSIHANDLE (8) of type 0 for thread 1912
MSI (s) (60:78) [12:09:19:861]: Closing MSIHANDLE (7) of type 790536 for thread 884
MSI (s) (60:74) [12:09:19:861]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=2888000)
MSI (s) (60:74) [12:09:19:877]: PROPERTY CHANGE: Deleting UpdateStarted property. Its current value is '1'.
windows服务日志:
2016-08-16 17:08:59,522 [1776] INFO Service shutting down. [ShutDownService]
2016-08-16 17:08:59,616 [1776] DEBUG Service Stopped [PreStopOperations]
2016-08-16 17:09:03,488 [3868] INFO Service Started; Client Version: 1.4.7.0; OS: WIN8; Thread UI: en-US; Installed UI: en-US [OnStart]
2016-08-16 17:09:04,832 [3868] INFO OTBSurveyService: Stop event received [OnStop]
2016-08-16 17:09:04,847 [3868] INFO Service shutting down. [ShutDownService]
2016-08-16 17:09:18,931 [3868] DEBUG Service Stopped [PreStopOperations]
最佳答案
根据日志和 RemoveExistingProducts 文档。当您的升级发生在 afterInstallExecute 时,实际的事件顺序是首先安装新版本,然后卸载旧产品。
在 12:08:59 停止旧服务(从升级安装),然后删除旧服务。 然后安装新服务,并在 12:09:03.222 启动,服务配置操作也在那里进行。 在 12:09:04.535 RemoveExistingProducts 运行,卸载旧产品。那个uninstall在12:09:04:832有一个ServiceControl来停止服务(你刚刚安装的那个),因为你的ServiceControl有stop=both,也就是说它会在卸载的时候停止它,这个是旧版本的uninstall产品。
由于这是静态定义的行为,也许对可变行为最可能的解释是计时赛跑。例如,您新安装的服务可能还没有准备好接受大多数安装中的停止请求,因此它不会在旧产品卸载时停止。但是有时它确实会响应并关闭。
然而,撇开理论不谈,底线仍然是您拥有带有 ServiceControl stop=both 的代码,并且卸载带有 stop 的旧产品是最后发生的事情(请注意,您仅在安装时开始,不是卸载!)。您可能需要更改升级顺序,因为 stop=both 在较旧的已安装产品中,例如,如果不使用补丁更改它就无法修复。您的升级 afterInstallInitialize 应该没问题,因为安装实际上是在卸载旧产品之后进行的。
关于windows - WiX 在重大升级后删除 Windows 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38920798/
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
我需要在客户计算机上运行Ruby应用程序。通常需要几天才能完成(复制大备份文件)。问题是如果启用sleep,它会中断应用程序。否则,计算机将持续运行数周,直到我下次访问为止。有什么方法可以防止执行期间休眠并让Windows在执行后休眠吗?欢迎任何疯狂的想法;-) 最佳答案 Here建议使用SetThreadExecutionStateWinAPI函数,使应用程序能够通知系统它正在使用中,从而防止系统在应用程序运行时进入休眠状态或关闭显示。像这样的东西:require'Win32API'ES_AWAYMODE_REQUIRED=0x0
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
尝试通过RVM将RubyGems升级到版本1.8.10并出现此错误:$rvmrubygemslatestRemovingoldRubygemsfiles...Installingrubygems-1.8.10forruby-1.9.2-p180...ERROR:Errorrunning'GEM_PATH="/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/ruby-1.9.2-p180@global:/Users/foo/.rvm/gems/ruby-1.9.2-p180:/Users/foo/.rvm/gems/rub
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
查看Ruby的CSV库的文档,我非常确定这是可能且简单的。我只需要使用Ruby删除CSV文件的前三列,但我没有成功运行它。 最佳答案 csv_table=CSV.read(file_path_in,:headers=>true)csv_table.delete("header_name")csv_table.to_csv#=>ThenewCSVinstringformat检查CSV::Table文档:http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV/Table.html
我发现ActiveRecord::Base.transaction在复杂方法中非常有效。我想知道是否可以在如下事务中从AWSS3上传/删除文件:S3Object.transactiondo#writeintofiles#raiseanexceptionend引发异常后,每个操作都应在S3上回滚。S3Object这可能吗?? 最佳答案 虽然S3API具有批量删除功能,但它不支持事务,因为每个删除操作都可以独立于其他操作成功/失败。该API不提供任何批量上传功能(通过PUT或POST),因此每个上传操作都是通过一个独立的API调用完成的
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru