开发者

using .asmx using lighttpd and mono fastcgi

开发者 https://www.devze.com 2023-04-09 22:50 出处:网络
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.

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

U开发者_Python百科sing 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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消