Self-hosting ASP.NET 5 within .NET 4.5 Application (without DNX and IIS)

孤人 提交于 2019-12-24 03:30:41

问题


Is it possible to add an ASP.NET 5 Web Application as a reference to a traditional .NET 4.5 project (Windows Service or Console App) and start it in-process?

Ideally within one solution, so that ASP.NET application and host service can share references to other projects in the same solution.

Tried so far:

dnu publish produces packages, but attempting to add them produces following error: Install-Package : Could not install package 'WebApplication1 1.0.0'. You are trying to install this package into a project that targets '.NETFramework, Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. When changing framework dnx451 to net451, Web Application doesn't compile because of missing ASP references.

dnu build produces binaries, but how to run the application? (where to get IApplicationBuilder and IHostingEnvironment instances?)


回答1:


Nope. It is not possible to run an ASP.NET 5 application without DNX.

But you can run an ASP.NET 5 application without IIS. It can be self-hosted.



来源:https://stackoverflow.com/questions/31101139/self-hosting-asp-net-5-within-net-4-5-application-without-dnx-and-iis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!