简体   繁体   English

您可以在IIS中托管ServiceStack Web App吗?

[英]Can you host a ServiceStack Web App in IIS?

I have made a ServiceStack Web App that uses a custom AppHost from a plugin (similar to the example https://github.com/NetCoreWebApps/WebApp/tree/master/src/apps/chat ). 我已经制作了一个使用插件中的自定义AppHost的ServiceStack Web应用程序(类似于示例https://github.com/NetCoreWebApps/WebApp/tree/master/src/apps/chat )。 I can run it on macOS with the dotnet command as per the examples. 我可以按照示例使用dotnet命令在macOS上运行它。

Can I host my Service Stack Web App on IIS? 我可以在IIS上托管我的Service Stack Web App吗? What approach should I take? 我应该采取什么方法? Reverse-proxying Kestrel like this https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x 像这样的反向代理Kestrel https://docs.microsoft.com/zh-cn/aspnet/core/publishing/iis?tabs=aspnetcore2x

or will I need to have different AppHost/Startup code for the two hosting situations? 还是在两种托管情况下需要使用不同的AppHost / Startup代码?

Or maybe there's a fundamental reason why it will never work? 也许有一个根本原因使其永远无法工作?

WebApp is a standard .NET Core 2.0 App so you'll be able to host it as you would any other .NET Core App. WebApp是标准的.NET Core 2.0应用程序,因此您可以像托管任何其他.NET Core应用程序一样托管它。 Normally reverse proxies don't require anything except the internal url where the request is proxied to , but it looks like IIS wants you to explicitly call .UseIISIntegration() which is an issue that may have prevented the existing WebApp binary as it didn't call .NET Core 2.0 WebHost.CreateDefaultBuilder(args) which among other things would turn on IISIntegration when the .NET Core App is hosted in IIS/Windows which is now being done from this commit . 通常,反向代理不需要任何东西,除了将请求代理到内部URL之外,但是IIS似乎希望您显式调用.UseIISIntegration() ,这可能会阻止现有WebApp二进制文件,因为它没有阻止该问题调用.NET Core 2.0 WebHost.CreateDefaultBuilder(args) ,当将.NET Core应用程序托管在IIS / Windows中时,该IISIntegration将打开IISIntegration ,此操作现在通过此commit完成。

You can find the updated Web App binaries with this change in the /web folder of the https://github.com/NetCoreWebApps/Chat project. 您可以在https://github.com/NetCoreWebApps/Chat项目的/web文件夹中找到具有此更改的更新的Web App二进制文件。

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

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