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
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.
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.