简体   繁体   English

驻留在ASP.NET 4 IIS网站中的ASP.NET Core Web API

[英]ASP.NET Core Web API living inside a ASP.NET 4 IIS Web Site

I am tasked to to build a Web API application. 我负责构建一个Web API应用程序。 The app will be hosted inside an existing web site - a pre-ASP.NET 5 web application with a WCF web service. 该应用程序将托管在现有网站内-带有WCF Web服务的ASP.NET 5之前的Web应用程序。

I wonder - can I build the web-api application using ASP.NET Core 1 in a way that it can happily exists as a sub application inside the already existing site in IIS? 我想知道-是否可以使用ASP.NET Core 1来构建Web-api应用程序,使其可以作为子应用程序愉快地存在于IIS中已经存在的站点中?

Thanks! 谢谢!

If I understand you correctly it is not possible what you want. 如果我对您的理解正确,那么您将无法获得所需的东西。 Please refer to the following documentation about hosting ASP.NET Core on IIS: https://docs.asp.net/en/latest/publishing/iis.html . 请参考以下有关在IIS上托管ASP.NET Core的文档: https : //docs.asp.net/en/latest/publishing/iis.html

If you specifically look at the .NET CLR version in the application pool it should be "No Managed Code" while your current website is set to a .NET framework version I assume. 如果您专门查看应用程序池中的.NET CLR版本,而您当前的网站设置为我假设的.NET框架版本,则应为“无托管代码”。 This is because ASP.NET Core is now cross plaform and completely web server agnostic. 这是因为ASP.NET Core现在跨平台并且完全与Web服务器无关。 It even needs a little 'trick' (the ASP.NET Core Module) to work on IIS. 它甚至需要一些“技巧”(ASP.NET核心模块)才能在IIS上工作。 See: "The module creates the reverse-proxy between IIS and the Kestrel server." 请参阅:“该模块在IIS和Kestrel服务器之间创建反向代理。”

But if you follow the link provided above I think you'll manage to work it out. 但是,如果您点击上面提供的链接,我认为您将可以解决它。

Yes, this is possible, I'm doing the opposite of this scenario but conceptually its the same thing. 是的,这是可能的,我正在做与这种情况相反的事情,但从概念上讲是同一件事。 You need to create your subsite as a separate application in IIS with its own app pool. 您需要在IIS中使用自己的应用程序池将其子站点创建为单独的应用程序。 That app pool needs to be configured No Managed Code per the instructions on the Docs site https://docs.asp.net/en/latest/publishing/iis.html 根据文档网站https://docs.asp.net/en/latest/publishing/iis.html上的说明,该应用程序池需要配置为“无托管代码”

The only other thing you need to watch out for is that the web.config in the subsite will inherit some settings from the root web.config, so you need to remove or clear things sometimes like handlers, modules, etc. 您需要注意的唯一另一件事是子站点中的web.config将继承根web.config的某些设置,因此您需要删除或清除某些内容,例如处理程序,模块等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM