This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.UseSpa(spa => | |
{ | |
if (_environment.IsDevelopment()) | |
{ | |
// Make sure you have started the frontend with npm run dev on port 4000 | |
spa.UseProxyToSpaDevelopmentServer("http://localhost:4000"); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method gets called by the runtime. Use this method to add services to the container. | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
// ... | |
services.AddSpaStaticFiles(configuration => | |
{ | |
configuration.RootPath = "wwwroot"; | |
}); | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | |
public void Configure(IApplicationBuilder app) | |
{ | |
// ... | |
app.UseDefaultFiles(); | |
app.UseStaticFiles(); | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AnotherWorker : BackgroundService | |
{ | |
private readonly IHostApplicationLifetime _hostApplicationLifetime; | |
public AnotherWorker(IHostApplicationLifetime hostApplicationLifetime) | |
{ | |
_hostApplicationLifetime = hostApplicationLifetime; | |
} | |
public override Task StartAsync(CancellationToken cancellationToken) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds all nugets for easier local development | |
mac: | |
dotnet pack src/Your.Project.Here.csproj -o ~/localfeed | |
windows: | |
dotnet pack src/Your.Project.Here.csproj -o c:\localfeed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IgnoreRequestPathsTelemetryProcessor : ITelemetryProcessor | |
{ | |
private readonly ITelemetryProcessor _next; | |
public IgnoreRequestPathsTelemetryProcessor(ITelemetryProcessor next) | |
{ | |
_next = next; | |
} | |
public void Process(ITelemetry item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
// .... | |
services.AddApplicationInsightsTelemetry(Configuration); | |
services.AddApplicationInsightsTelemetryProcessor<IgnoreRequestPathsTelemetryProcessor>(); | |
// .... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pacific/Niue | |
Pacific/Midway | |
Pacific/Pago_Pago | |
America/Adak | |
Pacific/Rarotonga | |
Pacific/Tahiti | |
Pacific/Honolulu | |
Pacific/Marquesas | |
America/Metlakatla | |
America/Sitka |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Function | |
{ | |
private static ServiceProvider ServiceProvider { get; set; } | |
/// <summary> | |
/// The parameterless constructor is what Lambda uses to construct your instance the first time. | |
/// It will only ever be called once for the lifetime of the container that it's running on. | |
/// We want to build our ServiceProvider once, and then use the same provider in all subsequent | |
/// Lambda invocations. This makes things like using local MemoryCache techniques viable (Just | |
/// remember that you can never count on a locally cached item to be there!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
// network call | |
} | |
catch(Exception e) | |
{ | |
_logger.Error(e, "Network call failed"); | |
} |