我已经设法使用
HttpListener host让Katana / OWIN在Mono上运行.
我现在正在Mono和XSP4上试验Microsoft.Owin.Host.SystemWeb.我正在使用this repo中的代码.它有一个Startup class:
using Owin;
namespace KatanaSystemWebTest
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseDiagnosticsPage();
}
}
}
在web.config中,我们将Configuration()方法定义为启动应用程序的方法:
<appSettings>
<add key="owin:AppStartup" value="KatanaSystemWebTest.Startup.Configuration,KatanaSystemWebTest" />
<add key="owin:AutomaticAppStartup" value="true" />
<add key="webpages:Enabled" value="false" />
</appSettings>
这在Visual Studio中调试时效果很好,但在Mono上没有.我猜它是某种不会被解雇的程序集加载钩子.有什么建议?
这是运行代码的应用程序:http://peaceful-forest-6785.herokuapp.com/
Full source code.
我通过使用程序集属性告诉XSP哪个是Startup类和方法来实现这一点:
using Owin;
using Microsoft.Owin; // <--- this is new
// this is new:
[assembly: OwinStartup (typeof (KatanaSystemWebTest.Startup),"Configuration")]
namespace KatanaSystemWebTest
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseDiagnosticsPage();
}
}
}
我还在repo中创建了一个pull pull请求.