简体   繁体   English

由于名称空间的更改,服务结构升级失败

[英]Service fabric upgrade failing due to change in namespace

I have a service fabric application stuck in "Upgrading" mode. 我有一个服务结构应用程序卡在“升级”模式。 The exception is: 例外是:

Could not load type 'DB.IAddUser' from assembly 'DB' at WebApi.Startup.ConfigureServices(IServiceCollection services) 无法从WebApi.Startup.ConfigureServices(IServiceCollection服务)的程序集“DB”加载类型“DB.IAddUser”

My change was that of renaming the name space, from 'DB' to 'DB.Interfaces'. 我的更改是重命名名称空间,从“DB”到“DB.Interfaces”。

This class is only used as a constructor dependency, and registered as such 此类仅用作构造函数依赖项,并按此注册

Startup.cs Startup.cs

services.AddSingleton<IAddUser, AddUser>();

UserController.cs UserController.cs

private IAddUser addUser;
public UserController(IAddUser addUser){
   this.addUser = addUser;
}

Why would this cause SF to get stuck? 为什么会导致SF卡住?

Additionally, it only got stuck on the last upgrade domain, and not on the others. 此外,它只会卡在最后一个升级域上,而不会停留在其他域上。

I might be mistaken but if upgrade was successful on other upgrade domains then it is not code related issue. 我可能会弄错,但如果升级在其他升级域上成功,那么它不是代码相关的问题。

Try to rollback the application upgrade and upgrade again: Start-ServiceFabricApplicationRollback -ApplicationName fabric:/MyApp 尝试回滚应用程序升级并再次升级: Start-ServiceFabricApplicationRollback -ApplicationName fabric:/MyApp

documentation 文件

It turns out that this had nothing to do with service fabric (as expected and as @SteppingRazor said). 事实证明,这与服务结构无关(正如预期和@SteppingRazor所说)。 The problem seems to be related to MSBuild/Azure devops build task, I had upgraded nuget package 问题似乎与MSBuild / Azure devops构建任务有关,我已经升级了nuget包

Microsoft.VisualStudio.Azure.Fabric.MSBuild Microsoft.VisualStudio.Azure.Fabric.MSBuild

from 1.6.7 to 1.6.8 and it seems that the build was still using older code (confirmed via a decompiler). 从1.6.7到1.6.8,似乎构建仍在使用旧代码(通过反编译器确认)。

Reverting back to 1.6.7 solved the issue (albeit its just a workaround) 恢复到1.6.7解决了这个问题(虽然它只是一个解决方法)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM