自主机Asp.net MVC 4.5.2 [英] Self host Asp.net MVC 4.5.2

查看:76
本文介绍了自主机Asp.net MVC 4.5.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试自行托管Asp.Net 4.5 MVC 5应用程序.现在,经过一些研究,似乎无法使用此框架完成此操作,因此需要将其切换到Nancy.

I am attempting to self host a Asp.Net 4.5 MVC 5 application. Now after some research it seems this cannot be done with this framework, it would require switching it out for Nancy.

我知道Asp.Net 5通过Owin支持此功能.我已经能够将MVC项目转换为新的Asp.Net 5项目(带有project.json),并将运行时版本设置为.net 4.5

I understand that Asp.Net 5 supports this with Owin. I have been able to convert my MVC project into the new Asp.Net 5 project (with the project.json) and set my runtime version as .net 4.5

  "frameworks": {
    "net45": {
      "dependencies": { } 
    }
  }, 

因此,我仍然可以在解决方案中使用其他.Net 4.5项目(否则,我需要升级所有项目及其依赖项,其中一些尚不支持.Net 5).有什么办法可以这样自我托管?

This is so I can still use the other .Net 4.5 projects in my solution (otherwise I need to upgrade all of my projects and their dependencies, which some do not support .Net 5 yet). Is there any way to self host like this?

推荐答案

您要在应用中定位哪个Asp.Net 5版本?对于RC2版本,托管API有所更改,因此您在网上找到的其他示例可能不再起作用,请参见此处以获取更多信息,它还解释了其他人如何使用IIS进行自我托管,因此希望对IIS有用.你: 对托管API的更改

Which Asp.Net 5 build are you targeting in your app? For the RC2 builds the hosting API has changed somewhat and therefore other examples you find online may not work anymore, please see here for more information on that, it also explains how other's are using IIS to self-host so hopefully that will prove useful to you: Changes to hosting API

了解打算使用哪个服务器自托管应用程序也将很有帮助.通常使用Kestrel,但它应始终位于Web服务器(如Nginx,Apache或IIS)的后面,并且永远不要直接公开.

It would also be helpful to know which server you're planning on using to self-host your app. Generally Kestrel is used but this should always be behind a Web Server such as Nginx, Apache or IIS, and never exposed directly.

这篇关于自主机Asp.net MVC 4.5.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆