microsoft / service-fabric-issues

This repo is for the reporting of issues found with Azure Service Fabric.
168 stars 21 forks source link

Service Fabric deployment issue on Azure Service fabric cluster #1699

Closed TestUser0811 closed 3 years ago

TestUser0811 commented 3 years ago

On deploying Service fabric service on Azure Service fabric cluster, deployment fails with the exception mentioned in the screenshot As per Azure portal, Service Fabric version : 6.1.480.9494

Problematic code:

      var service = $"{hostName}:/{_applicationName}/{serviceName}";
        var servicePartitionResolver = ServicePartitionResolver.GetDefault();

       **var partition = await servicePartitionResolver.ResolveAsync(new System.Uri(service),
            new ServicePartitionKey(), default(CancellationToken));** // _Exactly this line throws up the exception_

        var serviceEndpointJson = partition.GetEndpoint().Address;
        string endpointUrl = JObject.Parse(serviceEndpointJson)["Endpoints"][string.Empty].Value<string>();
        return endpointUrl.TrimEnd('/');

The above of code is used in ConfigureServices(IServiceCollection services) method inside startup.cs

Below are Service fabric related nuget packages referred in the concern service fabric service project,

             <PackageReference Include="Microsoft.ServiceFabric" Version="7.1.417" />
               <PackageReference Include="Microsoft.ServiceFabric.AspNetCore.WebListener" Version="4.1.417" />
              <PackageReference Include="Microsoft.ServiceFabric.Data" Version="4.1.417" />
            <PackageReference Include="Microsoft.ServiceFabric.Services" Version="4.1.417" />

       <TargetFramework>netcoreapp2.1</TargetFramework>

Please suggest the solution for the issue mentioned in the below screenshot.

image

juho-hanhimaki commented 3 years ago

Your cluster is very old (unsupported) version and you're trying to use much newer version of nuget packages. That might cause a compatibility issue.

Not saying that is the problem because I am not really expert but maybe something you can investigate.

List of compatible versions: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-versions