{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Home/issues/3010","repository_url":"https://api.github.com/repos/aspnet/Home","labels_url":"https://api.github.com/repos/aspnet/Home/issues/3010/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Home/issues/3010/comments","events_url":"https://api.github.com/repos/aspnet/Home/issues/3010/events","html_url":"https://github.com/aspnet/Home/issues/3010","id":309819846,"number":3010,"title":"To use UseSpaStaticFiles, you must first register an ISpaStaticFileProvider in Azure Service Fabric","user":{"login":"KTazayan","id":34863779,"avatar_url":"https://avatars0.githubusercontent.com/u/34863779?v=4","gravatar_id":"","url":"https://api.github.com/users/KTazayan","html_url":"https://github.com/KTazayan","followers_url":"https://api.github.com/users/KTazayan/followers","following_url":"https://api.github.com/users/KTazayan/following{/other_user}","gists_url":"https://api.github.com/users/KTazayan/gists{/gist_id}","starred_url":"https://api.github.com/users/KTazayan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KTazayan/subscriptions","organizations_url":"https://api.github.com/users/KTazayan/orgs","repos_url":"https://api.github.com/users/KTazayan/repos","events_url":"https://api.github.com/users/KTazayan/events{/privacy}","received_events_url":"https://api.github.com/users/KTazayan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-29T16:22:57Z","updated_at":"2018-03-30T05:41:08Z","closed_at":null,"author_association":"NONE","body":"I'm using the latest version of SPA templates: Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0\r\nCreating Angular app by:\r\n\r\n>dotnet new angular\r\n\r\nand getting the following error when deploy it in Azure SF stateless service:\r\n\r\n```\r\nUnhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.\r\nReplica had multiple failures during open on _Node1_0. API call: IStatelessServiceInstance.Open(); Error = System.InvalidOperationException (-2146233079)\r\nTo use UseSpaStaticFiles, you must first register an ISpaStaticFileProvider in the service provider, typically by calling services.AddSpaStaticFiles.\r\n   at Microsoft.Extensions.DependencyInjection.SpaStaticFilesExtensions.ShouldServeStaticFiles(IApplicationBuilder app, Boolean allowFallbackOnServingWebRootFiles, IFileProvider& fileProviderOrDefault)\r\n   at Microsoft.Extensions.DependencyInjection.SpaStaticFilesExtensions.UseSpaStaticFilesInternal(IApplicationBuilder app, StaticFileOptions staticFileOptions, Boolean allowFallbackOnServingWebRootFiles)\r\n   at AppApiGateway.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in C:\\Users\\Yatajga\\Source\\Repos\\DistrTest\\src\\ServiceFabric\\AppApiGateway\\Startup.cs:line 68\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)\r\n   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()\r\n   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()\r\n   at AppApiGateway.AppApiGateway.<>c__DisplayClass1_0.b__1(String url, AspNetCoreCommunicationListener listener) in C:\\Users\\Yatajga\\Source\\Repos\\DistrTest\\src\\ServiceFabric\\AppApiGateway\\AppApiGateway.cs:line 44\r\n   at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)\r\n   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__19.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()\r\nFor more information see: http://aka.ms/sfhealth\r\n```\r\n\r\n```c#\r\ninternal sealed class AppApiGateway : StatelessService\r\n    {\r\n        public AppApiGateway(StatelessServiceContext context)\r\n            : base(context)\r\n        { }\r\n\r\n        /// <summary>\r\n        /// Optional override to create listeners (like tcp, http) for this service instance.\r\n        /// </summary>\r\n        /// <returns>The collection of listeners.</returns>\r\n        protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()\r\n        {\r\n            return new ServiceInstanceListener[]\r\n            {\r\n                new ServiceInstanceListener(serviceContext =>\r\n                    new KestrelCommunicationListener(serviceContext, \"ServiceEndpoint\", (url, listener) =>\r\n                    {\r\n                        ServiceEventSource.Current.ServiceMessage(serviceContext, $\"Starting Kestrel on {url}\");\r\n\r\n                        // Read environment from config files\r\n                        var environment = FabricRuntime.GetActivationContext()?\r\n                            .GetConfigurationPackageObject(\"Config\")?\r\n                            .Settings.Sections[\"Environment\"]?\r\n                            .Parameters[\"ASPNETCORE_ENVIRONMENT\"]?.Value;\r\n\r\n                        return new WebHostBuilder()\r\n                            .UseKestrel()\r\n                            .ConfigureServices(\r\n                                services => services\r\n                                    .AddSingleton<StatelessServiceContext>(serviceContext))\r\n                            .UseContentRoot(Directory.GetCurrentDirectory())\r\n                            .UseStartup<Startup>()\r\n                            .UseEnvironment(environment)\r\n                            .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)\r\n                            .UseUrls(url)\r\n                            .Build();\r\n                    }))\r\n            };\r\n        }\r\n    }\r\n```\r\n\r\n```c#\r\n// This method gets called by the runtime. Use this method to add services to the container.\r\npublic IServiceProvider ConfigureServices(IServiceCollection services)\r\n{\r\n    services.AddSignalR();\r\n    services.AddMvc();\r\n\r\n    services.AddSingleton<IClusterClient>(sp =>\r\n    {\r\n        OrleansConfiguration.StartClientWithRetries(out var client);\r\n        return client;\r\n    });\r\n\r\n    var container = new ContainerBuilder();\r\n    container.Populate(services);\r\n\r\n    // In production, the Angular files will be served from this directory\r\n    services.AddSpaStaticFiles(configuration =>\r\n    {\r\n        configuration.RootPath = \"ClientApp/dist\";\r\n    });\r\n\r\n    return new AutofacServiceProvider(container.Build());\r\n}\r\n\r\n// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.\r\npublic void Configure(IApplicationBuilder app, IHostingEnvironment env)\r\n{\r\n    app.UseSignalR(routes =>\r\n    {\r\n        routes.MapHub<ProductMessageHub>(\"ProductMessageHub\");\r\n    });\r\n\r\n    if (env.IsDevelopment())\r\n    {\r\n        app.UseDeveloperExceptionPage();\r\n    }\r\n    else\r\n    {\r\n        app.UseExceptionHandler(\"/Home/Error\");\r\n    }\r\n\r\n    app.UseStaticFiles();\r\n    app.UseSpaStaticFiles();\r\n\r\n    app.UseMvc(routes =>\r\n    {\r\n        routes.MapRoute(\r\n            name: \"default\",\r\n            template: \"{controller}/{action=Index}/{id?}\");\r\n    });\r\n\r\n    app.UseSpa(spa =>\r\n    {\r\n        // To learn more about options for serving an Angular SPA from ASP.NET Core,\r\n        // see https://go.microsoft.com/fwlink/?linkid=864501\r\n\r\n        spa.Options.SourcePath = \"ClientApp\";\r\n\r\n        if (env.IsDevelopment())\r\n        {\r\n            spa.UseAngularCliServer(npmScript: \"start\");\r\n        }\r\n    });\r\n\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Home/issues/comments/377450551","html_url":"https://github.com/aspnet/Home/issues/3010#issuecomment-377450551","issue_url":"https://api.github.com/repos/aspnet/Home/issues/3010","id":377450551,"user":{"login":"Eilon","id":202643,"avatar_url":"https://avatars3.githubusercontent.com/u/202643?v=4","gravatar_id":"","url":"https://api.github.com/users/Eilon","html_url":"https://github.com/Eilon","followers_url":"https://api.github.com/users/Eilon/followers","following_url":"https://api.github.com/users/Eilon/following{/other_user}","gists_url":"https://api.github.com/users/Eilon/gists{/gist_id}","starred_url":"https://api.github.com/users/Eilon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eilon/subscriptions","organizations_url":"https://api.github.com/users/Eilon/orgs","repos_url":"https://api.github.com/users/Eilon/repos","events_url":"https://api.github.com/users/Eilon/events{/privacy}","received_events_url":"https://api.github.com/users/Eilon/received_events","type":"User","site_admin":false},"created_at":"2018-03-30T05:41:08Z","updated_at":"2018-03-30T05:41:08Z","author_association":"OWNER","body":"@glennc - are you familiar with this type of issue in Service Fabric scenarios?"}}
{"actor":{"display_login":"Eilon"}}