Nginx背后的ASP.NET 5 [英] ASP.NET 5 behind nginx

查看:137
本文介绍了Nginx背后的ASP.NET 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Nginx服务器后面有一个ASP.NET 5 MVC6应用程序,它充当反向代理.其配置为:

I have a ASP.NET 5 MVC6 application behind a Nginx server that acts as a reverse proxy. Its configuration is :

server {
    listen       80;
    server_name  example.com;

    location / {
            proxy_pass   http://localhost:5000;
            client_max_body_size 50M;
            proxy_set_header Host $host;
    }
 }

在ASP.NET 5 RC1之前,它在Linux上运行良好.从那时起,在此之前的Windows上,对MVC 6控制器的请求将失败:我看到了响应,但浏览器继续加载,好像响应未完成(静态文件已正确提供).对http://localhost:5000/api/xxx的直接请求会立即响应并关闭.

It was working very well on Linux until the ASP.NET 5 RC1. Since then, and on Windows before that, the requests to MVC 6 controllers would fail: I see the response but the browser continues to load as if the response was not complete (static files are served correctly). A direct request to http://localhost:5000/api/xxx responds and closes immediatly.

我尝试添加proxy_buffering off,但是没有效果.我怀疑这与分块模式有关,但我对此没有在线发现.

I tried to add proxy_buffering off but it had no effect. I suspect that it is related to the chunked mode but I found nothing online about this.

推荐答案

这是已知问题在rc1中.当前的解决方法是将以下内容添加到您的nginx配置中;

This is a known issue in rc1. The current work around is to add the following to your nginx configuration;

proxy_set_header Connection keep-alive;

修复已计划用于rc2.

这篇关于Nginx背后的ASP.NET 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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