azure - 您可以在 Azure Service Fabric 项目中使用 project.json 吗?

标签 azure asp.net-core azure-service-fabric

我正在尝试使用 project.json 来简化 Service Fabric 项目中的包管理。

但是它失败了,我认为这是由于服务中未包含 ServiceFabricServiceModel.dll 造成的。我可以在 C:\Users\nick.nuget\packages\Microsoft.ServiceFabric.Actors\2.0.135\lib\net45 中的 nuget 包中看到 dll,但 nuspec 文件没有引用它。

尝试部署时出现不少错误。

例如

Exception thrown during async task execution
System.IO.FileNotFoundException: Could not load file or assembly 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
   at Microsoft.ServiceFabric.Services.Common.FabricServiceConfigSection.Initialize()
   at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportServiceRemotingProviderAttribute.CreateServiceRemotingListener(ServiceContext serviceContext, IService service)
   at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<OpenCommunicationListenersAsync>d__1b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<System.Fabric.IStatefulServiceReplica.ChangeRoleAsync>d__5.MoveNext()

=== Pre-bind state information ===
LOG: DisplayName = ServiceFabricServiceModel, Version=5.0.0.0,     Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/SfDevCluster/Data/_App/_Node_1/SceneSkopePlatformType_App0/ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.ServiceFabric.Services, Version=5.0.0.0,         Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SfDevCluster\Data\_App\_Node_1\SceneSkopePlatformType_App0\ServiceRegistrationServicePkg.Code.1.1.13 (2016-04-05 16.10.16Z)\ServiceRegistrationService.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: ServiceFabricServiceModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.

最佳答案

这是 dotnet cli 处理 nuget 包中未列出的程序集的方式的重大更改。对于“旧式”项目,VS2015 会将此程序集复制到项目输出,但 dotnet cli 不会。

在修复之前,您可以打包程序集或在发布后步骤中将其复制到输出。 程序集下载到: %userprofile%.nuget\packages\Microsoft.ServiceFabric.Services\2.0.135\lib\net45

关于azure - 您可以在 Azure Service Fabric 项目中使用 project.json 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36432091/

相关文章:

azure - 如何使用 Azure CLI 将应用服务从一个应用服务计划更改为另一应用服务计划

unit-testing - 将 asp.net 5 测试放在单独的程序集中

c# - .NET Core EntityFramework Identity - 更改 IdentityOptions(不在 Startup.cs 中)

azure-service-fabric - 升级到 Service Fabric SDK v2.3.301 后无法调试项目

azure - 无法连接到本地 Service Fabric 群集

security - 如何运行具有不同安全权限的Service Fabric应用程序?

azure - 将sqlserver数据库复制到azure

azure - 使用 powershell 下载 Azure 诊断日志

c# - "Access to the path ' D :\\Windows\\system32\\file is denied"Azure Web App

c# - asp.net core (3+) CreateScope() 上的共享上下文