gpt4 book ai didi

Azure 辅助角色使用错误的服务配置进行发布

转载 作者:行者123 更新时间:2023-12-03 04:33:58 24 4
gpt4 key购买 nike

我正在尝试在 VS2013 中为我的辅助角色云服务项目获取“发布到 azure”功能。

我遇到的问题是,无论我如何更改应用程序的服务配置设置,总是使用本地服务配置进行部署

我的.azurePubxml:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AzureCredentials>{"ServiceManagementEndpoint":"https:\/\/management.core.windows.net\/","SubscriptionId":"redacted"}</AzureCredentials>
<AzureDeleteDeploymentOnFailure>False</AzureDeleteDeploymentOnFailure>
<AzureDeploymentLabel>MyWorkerRole</AzureDeploymentLabel>
<AzureDeploymentReplacementMethod>AutomaticUpgrade</AzureDeploymentReplacementMethod>
<AzureSlot>Staging</AzureSlot>
<AzureEnableRemoteDesktop>True</AzureEnableRemoteDesktop>
<AzureEnableWebDeploy>False</AzureEnableWebDeploy>
<AzureFallbackToDeleteAndRecreateIfUpgradeFails>False</AzureFallbackToDeleteAndRecreateIfUpgradeFails>
<AzureHostedServiceLabel>MyLabel</AzureHostedServiceLabel>
<AzureHostedServiceName>MyService</AzureHostedServiceName>
<AzureEnableIntelliTrace>False</AzureEnableIntelliTrace>
<AzureEnableProfiling>False</AzureEnableProfiling>
<AzureServiceConfiguration>Staging</AzureServiceConfiguration>
<AzureSolutionConfiguration>Staging</AzureSolutionConfiguration>
<AzureStorageAccountLabel>webstorage</AzureStorageAccountLabel>
<AzureStorageAccountName>webstorage</AzureStorageAccountName>
<AzureAppendTimestampToDeploymentLabel>True</AzureAppendTimestampToDeploymentLabel>
</PropertyGroup>
</Project>

如您所见,AzureServiceConfiguration 设置为 Staging。如果我查看构建的输出,我可以看到这些行:

Target "ResolveServiceConfiguration" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Windows Azure Tools\2.6\Microsoft.WindowsAzure.targets" from project "path-to.ccproj" (target "CoreResolveServiceModel" depends on it):
3> Task "Message"
3> Target Profile: Local
3> Task "Message"
3> Service Configurations: ServiceConfiguration.Staging.cscfg;ServiceConfiguration.Production.cscfg;ServiceConfiguration.Local.cscfg
3> Task "Message"
3> Looking for a service configuration file named: ServiceConfiguration.Local.cscfg
3> Task "FindInList"
3> Task "Message"
3> Source Service Configuration: ServiceConfiguration.Local.cscfg
3> Task "Message"
3> Target Service Configuration: bin\Staging\ServiceConfiguration.cscfg

最终结果是在部署中使用 ServiceConfiguration.Local.cscfg 而不是 ServiceConfiguration.Staging.cscfg

有效的方法是将服务配置设置更改为“开发”->“运行/调试”下的暂存。 enter image description here

但是这个设置控制我在本地运行应用程序时使用哪个配置文件,所以我自然不想搞乱它。

此外,如果我使用 Project->Package... 选项并选择 staging,我会得到正确的包并生成正确的配置文件。我还尝试过从命令行使用 msbuild 手动构建,效果也很好。

尝试更新到azure sdk 2.6,希望能解决这个问题,但没有什么区别。

还应该说我在我的网络角色项目中使用了这个。但由于外部原因,我不得不将工作角色拆分到自己的云项目中。

更新更多信息,我再次仔细查看了构建日志,发现了以下内容:

 1>------ Build started: Project: MyProject, Configuration: Debug Any CPU ------
1>Build started 6/5/2015 5:15:03 PM.
1>Building with tools version "12.0".
1>Target "_CheckForInvalidConfigurationAndPlatform" in file "C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets" from project "path_to_project.csproj" (entry point):
1>Task "Error" skipped, due to false condition; ( '$(_InvalidConfigurationError)' == 'true' ) was evaluated as ( '' == 'true' ).
1>Task "Warning" skipped, due to false condition; ( '$(_InvalidConfigurationWarning)' == 'true' ) was evaluated as ( '' == 'true' ).
1>Using "Message" task from assembly "Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>Task "Message"
1> Task Parameter:Text=Configuration=Debug
1> Task Parameter:Importance=Low
1> Configuration=Debug

看来两者都不是

<AzureServiceConfiguration>Staging</AzureServiceConfiguration>
<AzureSolutionConfiguration>Staging</AzureSolutionConfiguration>

来自 .azurePubxml 的文件实际上被用作构建脚本的输入。

这一切似乎都归结为:发布到 Azure 函数如果不是从 .azurePubxml 文件中提取参数,那么它的参数是从哪里提取的?

最佳答案

从来没有在 VS2013 中完全正常工作,但现在我已经升级到 VS2015 并再次按预期发布到 Azure。

关于Azure 辅助角色使用错误的服务配置进行发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30646631/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com