Changes to let Net45 sample run over Owin
This commit is contained in:
parent
a6393e77ab
commit
85a25685d2
|
|
@ -0,0 +1,22 @@
|
||||||
|
#if NET45
|
||||||
|
using System;
|
||||||
|
using Microsoft.Owin.Hosting;
|
||||||
|
|
||||||
|
namespace MvcSample
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
const string baseUrl = "http://localhost:9001/";
|
||||||
|
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
using (WebApp.Start<Startup>(new StartOptions(baseUrl)))
|
||||||
|
{
|
||||||
|
Console.WriteLine("Listening at {0}", baseUrl);
|
||||||
|
Console.WriteLine("Press any key to exit");
|
||||||
|
Console.ReadKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
#if NET45
|
#if NET45
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.IO;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
using Microsoft.AspNet.Mvc.Razor;
|
using Microsoft.AspNet.Mvc.Razor;
|
||||||
using Microsoft.AspNet.Mvc.Routing;
|
using Microsoft.AspNet.Mvc.Routing;
|
||||||
using Microsoft.Owin;
|
|
||||||
using Microsoft.Owin.FileSystems;
|
using Microsoft.Owin.FileSystems;
|
||||||
using Owin;
|
using Owin;
|
||||||
|
|
||||||
[assembly: OwinStartup(typeof(MvcSample.Startup))]
|
|
||||||
|
|
||||||
namespace MvcSample
|
namespace MvcSample
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
|
|
@ -20,7 +17,12 @@ namespace MvcSample
|
||||||
|
|
||||||
var serviceProvider = MvcServices.Create();
|
var serviceProvider = MvcServices.Create();
|
||||||
|
|
||||||
string appRoot = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
|
// HACK to determine app root.
|
||||||
|
string appRoot = Environment.CurrentDirectory;
|
||||||
|
while (!String.IsNullOrEmpty(appRoot) && !appRoot.TrimEnd(Path.DirectorySeparatorChar).EndsWith("MvcSample"))
|
||||||
|
{
|
||||||
|
appRoot = Path.GetDirectoryName(appRoot);
|
||||||
|
}
|
||||||
|
|
||||||
serviceProvider.AddInstance<IFileSystem>(new PhysicalFileSystem(appRoot));
|
serviceProvider.AddInstance<IFileSystem>(new PhysicalFileSystem(appRoot));
|
||||||
serviceProvider.Add<IVirtualFileSystem, VirtualFileSystem>();
|
serviceProvider.Add<IVirtualFileSystem, VirtualFileSystem>();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
"Owin": "1.0",
|
"Owin": "1.0",
|
||||||
"Microsoft.Owin": "2.1.0",
|
"Microsoft.Owin": "2.1.0",
|
||||||
"Microsoft.Owin.Diagnostics": "2.1.0",
|
"Microsoft.Owin.Diagnostics": "2.1.0",
|
||||||
|
"Microsoft.Owin.Hosting": "2.1.0",
|
||||||
|
"Microsoft.Owin.Host.HttpListener": "2.1.0",
|
||||||
"Microsoft.AspNet.Abstractions.Owin": "0.1-alpha-*"
|
"Microsoft.AspNet.Abstractions.Owin": "0.1-alpha-*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue