I’ve deployed Asp.Net Webservice to connect to Riak on Ubuntu 16.04 using latest version of Mono, FastCGI and Nginx. The Webservice works fine when I access it on my browser. It also works fine if I send one request and wait for response before sending another request. The problem occur when I tried to send many requests at the same time (using www class in Unity3D Engine). From my testing I can only send request up to 7 requests simultaneously. More than that and Nginx/FastCGI would return 500 Internal Server Error. Log file has an access log for this error request.
x.x.x.x - - [27/Mar/2017:10:35:20 +0000] “POST /RiakService.asmx/GetValueMapBucket HTTP/1.1” 500 53 “-” “UnityPlayer/5.5.2f1 (http://unity3d.com)” “-”
But there is no error log in /var/log/nginx/error.log relate to this error request. So, it doesn’t help at all. My Webservice code shouldn’t have any problem because I’ve tested sending 10 requests on xsp4 instead of Nginx/FastCGI. It works correctly. Every request return correct result and no error. Is there any configuration in Nginx/FastCGI relate to this behavior? This is my Nginx configuration for proxy server.
server { location ~.asmx(.) { fastcgi_split_path_info ^(.+.asmx)(.)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include /usr/local/nginx/conf/fastcgi_params; fastcgi_pass 127.0.0.1:9000; } }
I tried using debug mode. These are log files when I sent 10 requests. All requests returned 500 Internal Server Error. I’m still a novice in this field. I really appreciate any help. https://pastebin.com/CJMH1GyB
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
From looking at the Mono Docs for NGINX, they recommend a slightly different configuration.
server {
listen 80;
server_name www.domain1.xyz;
access_log /var/log/nginx/your.domain1.xyz.access.log;
root /var/www/www.domain1.xyz/;
location / {
index index.html index.htm default.aspx Default.aspx;
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
}
}
With:
fastcgi_param PATH_INFO "";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
… being added to fastcgi_params
, or replacing what is already there if those are already set to values other than the above.
The default location of fastcgi_params
on Ubuntu is normally /etc/nginx/fastcgi_params
unless you have modified it and placed it elsewhere or installed a version of NGINX that isn’t in their repos.
http://www.mono-project.com/docs/web/fastcgi/nginx/
…
You can further modify the above server block and add error_log
to create a log specifically for that block as well. You’d add:
error_log /var/log/nginx/your.domain1.xyz.error.log;
… below or above access_log
. Once changes are made, you’d want to reload or restart NGINX.
service nginx reload
service nginx restart
or
systemctl reload nginx
systemctl restart nginx
I think that this is a bug in Mono framework. https://bugzilla.xamarin.com/show_bug.cgi?format=multiple&id=39874
The above configuration is old and some characters were removed when I posted. This is my current configuration file.