使用 .asmx 使用 lighttpd 和 mono fastcgi

发布于 2024-12-07 07:53:07 字数 268 浏览 1 评论 0原文

我已将 Web 服务部署到运行 lighttpd 和 fastcgi-mono-server2 的 ubuntu 服务器。 .asmx 页面加载正确,但当我测试该方法时,我得到 404。

我的 Web 服务称为 Import.asmx,我的方法称为 download,404 返回说 import.asmx/download 不存在

使用 xsp2 相同的服务工作完美,

我认为这与 lighttpd/fastcgi 如何提供 /download 有关,但不知道如何修复它。

I have deployed a web service to a ubuntu server running lighttpd and fastcgi-mono-server2. The .asmx page loads correctly but when I test the method I get a 404.

My web service is called Import.asmx and my method is called download and the 404 comes back saying import.asmx/download does not exist

Using xsp2 the same service works perfectly

I assume it is something to do with how the /download gets served by lighttpd/fastcgi but cannot work out how to fix it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吐个泡泡 2024-12-14 07:53:07

解决了 404 错误...但现在我有 500 错误。

实际上我在每次 MyService.asmx/SomeMethod post 调用时都会收到此错误。解决方案[不是真的]我已经弄清楚了:

location ~ \.(aspx|asmx|ashx|asmx\/(.*)|asax|ascx|soap|rem|axd|cs|config|dll)$ {
        fastcgi_pass   127.0.0.1:9001;
        index index.html index.htm default.aspx Default.aspx;
        fastcgi_index Default.aspx;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }

我已将其从仅 asmx 更改为 asmx/()*。好的,没有 404,但现在是 500:System.Web.HttpException:访问文件“/Services/MyService.asmx/MyMethod”时不允许使用方法“POST”。

这一发现给了我一些线索,表明 nginx 无法正确处理此类请求。经过谷歌搜索近2个小时后,我发现了 解决方案

location ~ \.asmx(.*) {
             fastcgi_split_path_info ^(.+\.asmx)(.*)$;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             fastcgi_param PATH_INFO $fastcgi_path_info;
             fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
             include /etc/nginx/fastcgi_params;
             fastcgi_index Default.aspx;
             fastcgi_pass 127.0.0.1:9001;
     }

我离它并不远。只需在当前位置规则之前添加此位置规则即可正常工作。

Solved the 404 error... but now I have a 500.

Actually I was getting this error on every MyService.asmx/SomeMethod post calls. The solution [NOT REALLY] I've figured it out:

location ~ \.(aspx|asmx|ashx|asmx\/(.*)|asax|ascx|soap|rem|axd|cs|config|dll)$ {
        fastcgi_pass   127.0.0.1:9001;
        index index.html index.htm default.aspx Default.aspx;
        fastcgi_index Default.aspx;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }

I've change it from only asmx to asmx/()*. Ok no 404 but now a 500: System.Web.HttpException: Method 'POST' is not allowed when accessing file '/Services/MyService.asmx/MyMethod'.

This findings give me some clues that nginx don't handle properly this kind of requests. After googling for almost 2 hours I've found a solution:

location ~ \.asmx(.*) {
             fastcgi_split_path_info ^(.+\.asmx)(.*)$;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
             fastcgi_param PATH_INFO $fastcgi_path_info;
             fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
             include /etc/nginx/fastcgi_params;
             fastcgi_index Default.aspx;
             fastcgi_pass 127.0.0.1:9001;
     }

I wasn't to far from it. Just add this location rule before the current you have and works fine.

北方的巷 2024-12-14 07:53:07

我有同样的问题。事实证明,这是在未找到资产时提供 404 服务的默认指令。删除了以下行:

try_files $uri $uri/ =404;

并在 /etc/nginx/fastcgi_params 中添加 PATH_INFO 作为 fastcgi 参数:

fastcgi_param  PATH_INFO        $fastcgi_path_info;

这为我解决了这个问题。希望有帮助。

I had the very same issue. Turned out to be default directive for serving 404 when not finding assets. Removed the following line:

try_files $uri $uri/ =404;

And add PATH_INFO as fastcgi param in /etc/nginx/fastcgi_params:

fastcgi_param  PATH_INFO        $fastcgi_path_info;

That fixed it for me. Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文