Skip to content

Instantly share code, notes, and snippets.

@thuru-zz
Last active July 30, 2018 17:10
Show Gist options
  • Save thuru-zz/4d3be4b0aa5727cf5a911f1f3eb37341 to your computer and use it in GitHub Desktop.
Save thuru-zz/4d3be4b0aa5727cf5a911f1f3eb37341 to your computer and use it in GitHub Desktop.
Http Sys and Static Port in SF
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new ServiceInstanceListener[]
{
new ServiceInstanceListener(serviceContext =>
new HttpSysCommunicationListener(serviceContext, "GatewayHttpSysServiceEnpoint", (url, listener) =>
{
ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting HttpSys on {url}");
return new WebHostBuilder()
.UseHttpSys()
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext))
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
.UseUrls(url)
.Build();
}))
};
<Endpoints>
<Endpoint Protocol="http" Name="GatewayHttpSysServiceEnpoint" Type="Input" Port="8080"/>
</Endpoints>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment