gpt4 book ai didi

rust - 在 IIS 中托管 Rust 应用程序

转载 作者:行者123 更新时间:2023-11-29 08:07:56 26 4
gpt4 key购买 nike

我发现了一篇关于自托管 Rust 应用程序的非常有趣的帖子,它们看起来不错。

我对如何将它托管在像 IIS 这样的 Web 服务器上很感兴趣,或者目前还不可能吗?

最佳答案

是的,可以在 IIS 中托管 Rust 应用程序。

我使用了相同的 approach used to host Suave applications in IISit worked .

在 IIS 上,关键是读取 IIS 希望您的应用程序监听的端口

let port = match env::var("HTTP_PLATFORM_PORT") {
Ok(val) => val,
Err(e) => "6767".to_string(),
};

我创建了 a small crate iis使其更易于在 a real Rust application 中使用喜欢这里 Nickel

let port = iis::get_port();
let listen_on = format!("127.0.0.1:{}", port);
server.listen(listen_on);

我相信这对于生产来说已经足够成熟了,就像给定的自托管 Rust 应用程序一样 HttpPlatformHandler IIS成熟稳定。

我还在 Free App Service plan in Azure 上做了一些非常基础和不科学的性能测试平均每秒大约 60 次点击。响应时间 100-200 毫秒。

关于rust - 在 IIS 中托管 Rust 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37512165/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com