1
나는 OWIN의 도움으로 자체 호스팅 응용 프로그램을 가지고 있습니다. 또한 일부 정적 파일을 제공해야합니다. 그것은 작동하지만 최근에 문제가 발생했습니다 - 기본 파일이 작동을 멈췄습니다. 이전에 localhost로 이동하면 "메인"페이지로 리디렉션됩니다. 그러나 이제는 주 페이지가 직접 경로를 통해서만 액세스 할 수 있습니다.OWIN 정적 파일을 사용하여 메인 페이지 정의하기
public class Startup
{
// This code configures Web API. The Startup class is specified as a type
// parameter in the WebApp.Start method.
public void Configuration(IAppBuilder appBuilder)
{
try
{
appBuilder.UseOAuthAuthorizationServer(new OAuthOptions());
appBuilder.UseJwtBearerAuthentication(new JwtOptions());
var config = new MyHttpsSelfHostConfiguration("https://localhost:4443");
var start = DateTime.Now;
config.MapHttpAttributeRoutes();
var jsonFormatter = new JsonMediaTypeFormatter();
config.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator(jsonFormatter));
config.Routes.MapHttpRoute(
name: "WebLabApp",
routeTemplate: "api/{controller}/{action}/{id}"
);
ConfigureUnity(config);
appBuilder.UseWebApi(config);
Console.WriteLine($"Configure Unity in {DateTime.Now - start}");
start = DateTime.Now;
BusinessServicesHostLibrary.ContainerRegistry.RegisterAllBusinessServicesCommonClassesAndConnectionFactory();
Console.WriteLine($"Register all in {DateTime.Now - start}");
#if DEBUG
var contentDir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent?.FullName;
#else
var contentDir = @".";
#endif
var fileSystem = new PhysicalFileSystem(contentDir);
var options = new FileServerOptions
{
EnableDefaultFiles = true,
DefaultFilesOptions = { DefaultFileNames = { "index.html" } },
FileSystem = fileSystem,
};
options.StaticFileOptions.FileSystem = fileSystem;
options.StaticFileOptions.ServeUnknownFileTypes = true;
appBuilder.UseFileServer(options);
config.EnsureInitialized();
}
catch (Exception ex)
{
if (ex is System.Reflection.ReflectionTypeLoadException)
{
var typeLoadException = ex as ReflectionTypeLoadException;
var loaderExceptions = typeLoadException.LoaderExceptions;
foreach (var x in loaderExceptions) Console.WriteLine(x);
}
throw;
}
}
내가 잘못 뭐하는 거지 : 여기 https://localhost:4443/index.html
내 시작 방법?