NServicebus-使用PowerShell管理NServiceBus

使用PowerShell管理NServiceBus

PowerShell,Commandlets, 安装

NServiceBus提供了一组PowerShell commandlets易于管理和运行的软件。最初的重点是与NServiceBus准备使用机器时提供支持。附加功能的管道。

在安装之前NServiceBus,确保PowerShell 2.0 +存在在目标机器上。

安装在V4.0 NServiceBus commandlets

这些能够方便NServiceBus.Powershell.dll。

您可以使用SDK安装程序(它将安装所有你需要运行您的开发环境)。

您可以使用Nuget:

创建一个新的类库项目,去 Package Manager Console

类型 Install-Package NServiceBus.PowerShell

完成后你会有 NServiceBus.Powershell.dll在你的包文件夹在您的解决方案目录中

使用visual studio内及时,你可以做

PM> Import-Module .packagesNServiceBus.PowerShell.<4.x.x your version>lib
et40NServiceBus.PowerShell.dll

然后使用cmdlet你想要的。

将会有更少的反馈,如果你运行的脚本里面的cmdlet Visual Studio。如果你得到警告可能是一个好主意从实际运行cmdlet PowerShell控制台。

或者你可以按照说明将它们加载到PowerShell使用Import-Module cmdlet:

PS> Import-Module .NServiceBus.Powershell.dll

或者你可以按照说明将它们加载到你的PowerShell概要文件。

如果您使用NuGet包,commandlets可用自动NuGet控制台。如果你使用MSI安装NServiceBus可以添加导入模块声明

我们所有的commandlets的详细描述,使用得到帮助命令:

PM> get-help about_NServiceBus

NServiceBus PowerShell能够方便被重新命名,这样他们不冲突与现有版本3.0能够方便:

Install-NServiceBusMSMQ

安装MSMQ的机器上。

Test-NServiceBusMSMQInstallation

验证MSMQ是否正确地安装在机器上。

Install-NServiceBusDTC

机器上安装DTC。

Test-NServiceBusDTCInstallation

验证如果DTC的机器上安装和运行。

Install-NServiceBusRavenDB

机器上安装RavenDB。

Test-NServiceBusRavenDBInstallation

确保RavenDB安装在这台机器。端口8080是用来检查RavenDB已经安装在机器上。如果RavenDB安装在一个不同的端口,测试可能显示错误。

Install-NServiceBusPerformanceCounters

机器上安装NServiceBus性能计数器。

Test-NServiceBusPerformanceCountersInstallation

验证NServiceBus性能计数器正确安装在机器上。

NServiceBus 4.5 Install-NServiceBusLicense(过时的)

安装在HKLM NServiceBus许可证文件。所有端点可以使用这台机器广泛设置,而不用指定许可文件在本文件夹中或在app.config文件中。

为说明如何安装许可证NServiceBus 4.5及以上请参考如何安装你的许可文件吗

Set-NServiceBusLocalMachineSettings

允许指定默认的错误和审核队列。在注册表中设置错误,审核队列在HKLM机广泛的设置。每个端点的机器上不再需要指定app.config文件中的这些设置

Get-NServiceBusLocalMachineSettings

显示了默认的错误和审核队列。

NServiceBus 4.5 Get-NServiceBusVersion(过时的)

显示NServiceBus安装版本。

NServiceBus 4.5 Get-NServiceBusMSMQMessage(过时的)

显示队列中的所有消息。

NServiceBus.Host不再支持 /installinfrastructure。PowerShell能够方便使用。

安装NServiceBus commandlets V3.0

能够方便的加载到PowerShell使用Import-Module cmdlet:

PM> Import-Module .NServiceBus.Core.dll

核心取决于 NServiceBus.dll log4net.dll所以确保都是在相同的目录中。

如果您使用NuGet包,commandlets可用自动NuGet控制台。如果你使用MSI安装NServiceBus可以添加导入模块声明PowerShell概要文件。

我们所有的commandlets的详细描述,使用得到帮助命令:

PM> get-help about_NServiceBus

基础设施commandlets

以下是可用的基础设施能够方便:

Install-Dtc

设置MSDTC NServiceBus。使用 -WhatIf验证当前状态没有做任何修改。

Install-Msmq

设置MSMQ NServiceBus。使用 -WhatIf验证当前状态没有做任何修改。如果需要MSMQ的重新安装,重新运行命令强制开关。

Install-RavenDB

设置RavenDB NServiceBus。使用 -WhatIf验证当前状态没有做任何修改。

Install-PerformanceCounters

安装NServiceBus性能计数器。使用 -WhatIf验证当前状态没有做任何修改。

Get-NServiceBusVersion

NServiceBus的当前版本(Semver)。

Install-License

安装一个NServiceBus许可证文件到注册中心。

已知的问题

如果你得到以下错误:

Import-Module : Could not load file or assembly
'file:///C:\Program Files (x86)\Particular Software\NServiceBus\v4.0\NServiceBus\Binaries\NServiceBus.PowerShell.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

虽然可以改变现有的版本 Powershell.exe.config加载。NET 4.0框架,首选的方法是安装PowerShell 3比改变配置文件。迫使PowerShell 2使用。净4可以打破PS Snapins从其他供应商。PowerShell 3提供了一个命令行选项切换版本的PS和。如果需要净。

原文地址:https://www.cnblogs.com/powerxu/p/4294325.html