-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
103 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Funq; | ||
using ServiceStack; | ||
using MyApp.ServiceInterface; | ||
|
||
[assembly: HostingStartup(typeof(MyApp.AppHost))] | ||
|
||
namespace MyApp; | ||
|
||
public class AppHost : AppHostBase, IHostingStartup | ||
{ | ||
public void Configure(IWebHostBuilder builder) => builder | ||
.ConfigureServices(services => { | ||
// Configure ASP.NET Core IOC Dependencies | ||
}) | ||
.Configure(app => { | ||
// Configure ASP.NET Core App | ||
if (!HasInit) | ||
app.UseServiceStack(new AppHost()); | ||
app.Run(context => | ||
{ | ||
context.Response.Redirect("/metadata"); | ||
return Task.FromResult(0); | ||
}); | ||
}); | ||
|
||
public AppHost() : base("MyApp", typeof(MyServices).Assembly) {} | ||
|
||
public override void Configure(Container container) | ||
{ | ||
// Configure ServiceStack only IOC, Config & Plugins | ||
SetConfig(new HostConfig { | ||
UseSameSiteCookies = true, | ||
}); | ||
} | ||
} |
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,15 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Hosting; | ||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Funq; | ||
using Microsoft.Extensions.Configuration; | ||
using ServiceStack; | ||
using MyApp.ServiceInterface; | ||
using MyApp.ServiceModel; | ||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
namespace MyApp | ||
{ | ||
public class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
var host = new WebHostBuilder() | ||
.UseKestrel() | ||
.UseContentRoot(Directory.GetCurrentDirectory()) | ||
.UseModularStartup<Startup>() | ||
.UseUrls(Environment.GetEnvironmentVariable("ASPNETCORE_URLS") ?? "http://localhost:5000/") | ||
.Build(); | ||
|
||
host.Run(); | ||
} | ||
} | ||
|
||
public class Startup : ModularStartup | ||
{ | ||
// This method gets called by the runtime. Use this method to add services to the container. | ||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 | ||
public new void ConfigureServices(IServiceCollection services) | ||
{ | ||
} | ||
var app = builder.Build(); | ||
|
||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. | ||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | ||
{ | ||
app.UseServiceStack(new AppHost()); | ||
|
||
app.Run(context => | ||
{ | ||
context.Response.Redirect("/metadata"); | ||
return Task.FromResult(0); | ||
}); | ||
} | ||
} | ||
// Configure the HTTP request pipeline. | ||
if (!app.Environment.IsDevelopment()) | ||
{ | ||
app.UseExceptionHandler("/Error"); | ||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. | ||
app.UseHsts(); | ||
app.UseHttpsRedirection(); | ||
} | ||
|
||
public class AppHost : AppHostBase | ||
{ | ||
public AppHost() | ||
: base("MyApp", typeof(MyServices).Assembly) { } | ||
app.Run(); | ||
|
||
public override void Configure(Container container) | ||
{ | ||
} | ||
} | ||
} |