我的构建已成功构建+部署在Azure群集中。 VSTS Build Tasks
我没有代码更改。我比较了工作和不工作的构建工件。我的MyCompany.MyService.Api.deps.json文件中有新条目:
...
"compilationOptions": {
"defines": [
...
"NETFRAMEWORK",
...
],
...
"Microsoft.Bcl.Build": "1.0.21",
"System.IdentityModel": "4.0.0.0",
"System.ServiceModel.Web": "4.0.0.0",
"System.Web.Services": "4.0.0.0",
"System.Runtime.Caching": "4.0.0.0",
"System.ServiceModel.Activation": "4.0.0.0"
},
...
"System.Transactions": "4.0.0.0",
"System.Web": "4.0.0.0",
"System.Diagnostics.Tracing.Reference1": "4.0.20.0",
"System.Runtime.Serialization.Primitives.Reference": "4.0.10.0",
"System.Runtime.Serialization.Xml.Reference": "4.0.10.0"
},
...
"System.Runtime.Reference1": "4.0.20.0",
"System.Threading.Tasks.Reference1": "4.0.10.0",
"System.Resources.ResourceManager.Reference1": "4.0.0.0",
"System.Globalization.Reference1": "4.0.10.0",
"System.Diagnostics.Tools.Reference1": "4.0.0.0",
"System.Diagnostics.Debug.Reference1": "4.0.10.0",
"System.Linq.Reference1": "4.0.0.0",
"System.Collections.Reference1": "4.0.10.0",
"System.Threading.Reference1": "4.0.10.0",
"System.Runtime.Extensions.Reference1": "4.0.10.0",
"System.IO.Reference1": "4.0.10.0",
"System.Runtime.InteropServices.Reference1": "4.0.20.0",
"System.Text.Encoding.Reference1": "4.0.10.0",
"System.Reflection.Primitives.Reference1": "4.0.0.0",
"System.Reflection.Reference1": "4.0.10.0",
"System.Text.Encoding.Extensions.Reference1": "4.0.10.0",
"System.ComponentModel.Reference": "4.0.0.0",
"System.Reflection.Extensions.Reference1": "4.0.0.0"
...
在过去的几个月中,我成功地进行了构建和部署。但是,在过去5天中,无法从VSTS构建中构建的代码部署到集群中。我的API服务无法启动,并且出现以下错误。请建议我如何调试。代码已成功部署并在我的本地集群中启动。
Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures during open on _ntsfmain_0. API call: IStatelessServiceInstance.Open(); Error = System.Collections.Generic.KeyNotFoundException (-2146232969)
The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency)
at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency)
at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.ComputeClassification(String dependency)
at Microsoft.AspNetCore.Mvc.Internal.DefaultAssemblyPartDiscoveryProvider.CandidateResolver.d__4.MoveNext()
at System.Linq.Enumerable.d__17`2.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.GetApplicationPartManager(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcCoreServiceCollectionExtensions.AddMvcCore(IServiceCollection services)
at Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions.AddMvc(IServiceCollection services)
at MyCompany.MyService.Api.Startup.ConfigureDevelopmentServices(IServiceCollection services) in C:\agent_C\_work\19\s\Source\MyCompany.MyService.Api\Startup.cs:line 39
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at MyCompany.MyService.Api.Api.<>c__DisplayClass4_0.b__1(String url, AspNetCoreCommunicationListener listener) in C:\agent_C\_work\19\s\Source\MyCompany.MyService.Api\Api.cs:line 91
at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()
For more information see: http://aka.ms/sfhealth
答案 0 :(得分:0)
这是与asp.net core 2.1相关的已知错误。几周前我们遇到了同样的问题。
对核心2.1的安装有一些相互冲突的依赖关系,这些依赖关系会影响其他点网络版本。 VSTS构建环境或SF可能已升级到核心2.1,并影响了您的旧构建。
您可以:
降级到2.0 : 在我们的例子中,我们有一些针对核心2.1以及1.1和2.0的服务,我们将所有服务降级到了核心2.0,问题得以解决。
或者,
您可以解决依赖项问题,在api的AddMvc()
行之前添加以下代码。
看起来像这样:
var manager = new ApplicationPartManager();
manager.ApplicationParts.Add(new AssemblyPart(typeof(Startup).Assembly));
manager.ApplicationParts.Add(new AssemblyPart(typeof(Project1.Project1Type).Assembly));
services.AddSingleton(manager);
services.AddMvc();
或者,
向解决方案中添加global.json
文件。
赞:
{
"sdk": {
"version": "2.1.200"
}
}
请关注此GitHub问题以获取更多信息: