我已经在Azure上安装并运行了Service Fabric。同时,我的Visual Studio解决方案有两个项目:Service Fabric和Web Service。
我想要将服务部署到Azure的Service Fabric中。
当我右键点击Service Fabric项目并点击“发布”时,服务能够平稳地部署到云端的可靠平台上。我想使用PowerShell实现同样的操作。
看来,我需要运行以下脚本:
# Connect to the cluster using a client certificate.
Connect-ServiceFabricCluster -ConnectionEndpoint $endpoint `
-KeepAliveIntervalInSec 10 `
-X509Credential -ServerCertThumbprint $thumbprint `
-FindType FindByThumbprint -FindValue $thumbprint `
-StoreLocation CurrentUser -StoreName My
# Copy the application package to the cluster image store.
Copy-ServiceFabricApplicationPackage $packagepath -ImageStoreConnectionString fabric:ImageStore -ApplicationPackagePathInImageStore $packagename
# Register the application type.
Register-ServiceFabricApplicationType -ApplicationPathInImageStore $packagename
# Create the service instance.
$appName = <name that I see in fabric explorer under 'typeName' in azure>
New-ServiceFabricService -ApplicationName fabric:/$appName -ServiceName fabric:/$appName/MyApp -ServiceTypeName $serviceTypeName -Stateless -PartitionSchemeSingleton -InstanceCount -1
在运行脚本之前,我右键单击我的布料应用程序并选择“打包”。
我的脚本的最后一条命令失败,并显示“找不到应用程序”。
可能缺少什么?
msbuild HelloWorld.sfproj /t:Package
命令构建了一个包? - LoekD