microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.01k stars 399 forks source link

Service Fabric - Consuming Remoting Service inside containers. #691

Open nareshkhatri81 opened 5 years ago

nareshkhatri81 commented 5 years ago

Team,

We have created stateless service which is exposing helloworld api using remoting. We are trying to consume helloworld api inside containers using remoting sdk.

Below is sample code to consume remoting api from containers.

    [HttpGet, Route("api/HelloWorldRemoting")]
    public string HelloWorldRemoting()
    {

        IMyService helloWorldClient = ServiceProxy.Create<IMyService>(new Uri("fabric:/rfapp/DataService"));
    string message = helloWorldClient.HelloWorldAsync().Result;
        return message;
    }

We are getting below exception

"IsError":true,"ErrorMessages":["The type initializer for 'System.Fabric.Common.AppTrace' threw an exception."," at System.Fabric.Common.AppTrace.get_TraceSource()\r\n at Microsoft.ServiceFabric.FabricTransport.FabricTransportSettings.TryLoadFrom(String sectionName, FabricTransportSettings& settings, String filepath, String configPackageName)\r\n at Microsoft.ServiceFabric.FabricTransport.FabricTransportSettings.GetDefault(String sectionName)\r\n at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportRemotingSettings.GetDefault(String sectionName)\r\n at Microsoft.ServiceFabric.Services.Remoting.FabricTransport.FabricTransportServiceRemotingProviderAttribute.CreateServiceRemotingClientFactoryV2(IServiceRemotingCallbackMessageHandler callbackMessageHandler)\r\n at Microsoft.ServiceFabric.Services.Remoting.V2.Client.ServiceProxyFactory.CreateServiceRemotingClientFactory(Type serviceInterfaceType)\r\n at Microsoft.ServiceFabric.Services.Remoting.V2.Client.ServiceProxyFactory.GetOrCreateServiceRemotingClientFactory(Type serviceInterfaceType)\r\n at Microsoft.ServiceFabric.Services.Remoting.V2.Client.ServiceProxyFactory.CreateServiceProxy[TServiceInterface](Uri serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName, Type serviceInterfaceType, ServiceProxyGenerator proxyGenerator)\r\n at Microsoft.ServiceFabric.Services.Remoting.V2.Client.ServiceProxyFactory.CreateServiceProxy[TServiceInterface](Uri serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)\r\n at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceProxy.Create[TServiceInterface](Uri serviceUri, ServicePartitionKey partitionKey, TargetReplicaSelector targetReplicaSelector, String listenerName)\r\n

amanbha commented 5 years ago

@nareshkhatri81 What is the Service Fabric runtime version of the cluster and what is the nuget package versions of Microsoft.ServiceFabric.Services.Remoting and Microsoft.ServiceFabric.Services nuget package.

nareshkhatri81 commented 5 years ago

@amanbha

SF runtime - 6.3.162.9494 Below are packages.

package id="Microsoft.ServiceFabric" version="6.3.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Data" version="3.2.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Data.Extensions" version="1.4.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Data.Interfaces" version="3.2.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Diagnostics.Internal" version="3.2.176" targetFramework="net461" package id="Microsoft.ServiceFabric.FabricTransport.Internal" version="3.2.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Services" version="3.2.176" targetFramework="net461" package id="Microsoft.ServiceFabric.Services.Remoting" version="3.2.176" targetFramework="net461"

amanbha commented 5 years ago

@nareshkhatri81 Sorry for the delay in response, Is the issue still happening for you? This seems like an mismatch in runtime and sdk, could you please try 3.2.162 version of Microsoft.ServiceFabric.Services.Remoting nuget package and the dependencies.

abarberenaCPDS commented 4 years ago

Hi @amanbha @BharatNarasimman , I believe I 'm having a similar issue, Do you mind taking a look to Issue 356?

edalx commented 4 years ago

Hi @amanbha I guess this is due to you need the cluster certificate installed in the container. Theoretically a container is a different host, therefore Service Fabric refuse the connection.