【发布时间】:2017-08-09 02:59:32
【问题描述】:
我正在努力从 Visual Studio 2017 [在 Windows 7] 中的 .Net 4.6.2 azure service fabric statefulservice 程序集中调用 .netstandard dll。我正在使用最新版本的服务结构 [5.4.164.9494 和 SF SDK 版本:2.4.164.9494]
按照Using .net standard 1.5 lib in .net 4.6.2 misses System.Runtime 4.1.0.0 中提到的确切步骤进行操作。尝试了多种方法,例如从 .Net 核心、.Netstandard 和普通的旧 PCL(从项目属性转换为 .net 标准)创建 netstandard 类库。没有任何效果。该项目确实编译但是当我将项目部署到集群时,有状态服务永远不会被初始化,这是日志中的错误..
{
"Timestamp": "2017-03-17T09:28:22.8026277-04:00",
"ProviderName": "Microsoft-ServiceFabric-Services",
"Id": 5,
"Message": "RunAsync has failed for a stateful service replica. Application Type Name: ServiceFabricTestType, Application Name: fabric:/ServiceFabricTest, Service Type Name: Stateful1Type, Service Name: fabric:/ServiceFabricTest/Stateful1, Partition Id: 17258b22-c015-4eec-8026-edd3e21fffc4, Replica Id: 131342308870035108, WasCancelled: False, Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
at Stateful1.Stateful1.<RunAsync>d__2.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Stateful1.Stateful1.RunAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceBase.Microsoft.ServiceFabric.Services.Runtime.IStatefulUserServiceReplica.RunAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<ExecuteRunAsync>d__12.MoveNext()
",
"ProcessId": 22424,
"Level": "Error",
"Keywords": "0x0000F00000000000",
"EventName": "StatefulRunAsyncFailure",
"ActivityID": null,
"RelatedActivityID": null,
"Payload": {
"applicationTypeName": "ServiceFabricTestType",
"applicationName": "fabric:/ServiceFabricTest",
"serviceTypeName": "Stateful1Type",
"serviceName": "fabric:/ServiceFabricTest/Stateful1",
"partitionId": "17258b22-c015-4eec-8026-edd3e21fffc4",
"replicaId": 131342308870035108,
"wasCanceled": false,
"exception": "System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
at Stateful1.Stateful1.<RunAsync>d__2.MoveNext()
at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
at Stateful1.Stateful1.RunAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceBase.Microsoft.ServiceFabric.Services.Runtime.IStatefulUserServiceReplica.RunAsync(CancellationToken cancellationToken)
at Microsoft.ServiceFabric.Services.Runtime.StatefulServiceReplicaAdapter.<ExecuteRunAsync>d__12.MoveNext()
"
}
}
任何帮助表示赞赏..
【问题讨论】:
-
repo 位于@github
标签: azure-service-fabric visual-studio-2017 .net-standard