using .asmx using lighttpd and mono fastcgi

后端 未结 2 829
我寻月下人不归
我寻月下人不归 2021-01-16 16:56

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.

M

相关标签:
2条回答
  • 2021-01-16 17:29

    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 讨论(0)
  • 2021-01-16 17:41

    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.

    0 讨论(0)
提交回复
热议问题