サービスリモート処理を使用して通信できる新しいAzureサービスアプリケーションを作成しています。 私はthis articleを参照しました。私は、エラーが直面しています:StatelessServiceから 'Microsoft.ServiceFabric.Services.Remoting.IService'への暗黙的な参照変換はありません。
The type 'PushMsgStatelessService.PushMsgStatelessService' cannot be used as type parameter 'TStatelessService' in the generic type or method 'ServiceRemotingExtensions.CreateServiceRemotingListener(TStatelessService, StatelessServiceContext)'. There is no implicit reference conversion from 'PushMsgStatelessService.PushMsgStatelessService' to 'Microsoft.ServiceFabric.Services.Remoting.IService'. PushMsgStatelessService C:\Nirvana\DataPerPerson\Narendra\PushMessageService\PushMsgStatelessService\PushMsgStatelessService.cs 30 Active
は私のコード:
using System.Collections.Generic;
using System.Fabric;
using System.Threading.Tasks;
using Microsoft.ServiceFabric.Services.Communication.Runtime;
using Microsoft.ServiceFabric.Services.Runtime;
using Microsoft.ServiceFabric.Services.Remoting.Runtime;
namespace PushMsgStatelessService
{
interface IPushMessageService
{
Task<string> GetMessageAsync();
}
/// <summary>
/// An instance of this class is created for each service instance by the Service Fabric runtime.
/// </summary>
internal sealed class PushMsgStatelessService : StatelessService, IPushMessageService
{
public PushMsgStatelessService(StatelessServiceContext context)
: base(context)
{ }
public Task<string> GetMessageAsync()
{
return Task.FromResult("Hello!");
}
/// <summary>
/// Optional override to create listeners (e.g., TCP, HTTP) for this service replica to handle client or user requests.
/// </summary>
/// <returns>A collection of listeners.</returns>
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new[] { new ServiceInstanceListener(context => this.CreateServiceRemotingListener(context)) };
}
}
}
私はここで立ち往生しています。
ありがとう、これは私の問題を解決しました。 –