0
私はこれを動作させることができません、私はグーグルで、おそらくこれを行う方法に関するすべてのページを見つけました。サービスファブリック、V2からステートフルサービスへのRemotingが動作しない
基本的には、ステートレス.NETコア2 MVCアプリケーションからStatefullサービスにSF Remoting V2を取り入れるだけです。コントローラーで
クライアントコードを:(可能な限り簡素化された):ここでは
は、私がやっていることだ
public class ValuesController : Controller
{
[HttpGet]
public async Task<IEnumerable<string>> Get()
{
// Provide certificate details.
var serviceProxyFactory = new ServiceProxyFactory((c) => new FabricTransportServiceRemotingClientFactory());
var proxy = serviceProxyFactory.CreateServiceProxy<ICallMe>(new Uri("fabric:/SFExperiment/Stateful1"));
var value3 = await proxy.GetGreeeting("Bob");
return new[] { "value1", "value2", value3 };
}
サービスコードインタフェース:
using System.Threading.Tasks;
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Remoting.FabricTransport;
[assembly: FabricTransportServiceRemotingProvider(RemotingListener =
RemotingListener.V2Listener, RemotingClient = RemotingClient.V2Client)]
namespace Stateful1.Abstractions
{
public interface ICallMe : IService
{
Task<string> GetGreeeting(string name);
}
}
サービスコード:
Public sealed class Stateful1 : StatefulService, ICallMe
{
public Stateful1(StatefulServiceContext context)
: base(context)
{ }
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
return this.CreateServiceRemotingReplicaListeners();
}
public Task<string> GetGreeeting(string name)
{
return Task.FromResult(@"Congratulations, you have remoting working. :-) ");
}
..私は次の例外を取得し、私は
<Resources>
<Endpoints>
<!-- To enable Service remonting for remoting services V2-->
<Endpoint Name="ServiceEndpointV2" />
<Endpoint Name="ReplicatorEndpoint" />
</Endpoints>
</Resources>
ServiceManifest.xml
に下に追加して、それが動作しません。無効なパーティション・キー/ ID '{0}' セレクタ{1}
私は間違っていますか?
うん、それだった...ありがとう。 – Choco