加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

Mono / XSP上的Microsoft.Owin.Host.SystemWeb

发布时间:2020-12-14 04:14:15 所属栏目:Windows 来源:网络整理
导读:我已经设法使用 HttpListener host让Katana / OWIN在Mono上运行. 我现在正在Mono和XSP4上试验Microsoft.Owin.Host.SystemWeb.我正在使用this repo中的代码.它有一个 Startup class: using Owin;namespace KatanaSystemWebTest{ public class Startup { publ
我已经设法使用 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请求.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读