Reputation: 867
My setup: Client (http:8080) Nginx (FastCGI:9000) fastcgi-mono-server
I want to host ASP.NET MVC 4 application, entirely built with WebAPI 2 controllers, configuration, etc, on Ubuntu with Mono 4 and fastcgi-mono-server4
, but for WebAPI routes it returns 400
:
System.ArgumentNullException
Value cannot be null.
Parameter name: path
Description: HTTP 400.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at System.IO.DirectoryInfo.CheckPath (System.String path) [0x00006] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
at System.IO.DirectoryInfo..ctor (System.String path, System.Boolean simpleOriginalPath) [0x00006] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
at System.IO.DirectoryInfo..ctor (System.String path) [0x00000] in <dca3b561b8ad4f9fb10141d81b39ff45>:0
at (wrapper remoting-invoke-with-check) System.IO.DirectoryInfo:.ctor (string)
at Mono.WebServer.FastCgi.WorkerRequest.GetFilePath () [0x00035] in <a872d12009ac4a668f0d504d764f1c44>:0
at Mono.WebServer.MonoWorkerRequest.GetFilePathTranslated () [0x00001] in <5b4128956e344d60b82a5fd7012fd8a1>:0
at Mono.WebServer.MonoWorkerRequest.AssertFileAccessible () [0x00010] in <5b4128956e344d60b82a5fd7012fd8a1>:0
at Mono.WebServer.MonoWorkerRequest.ProcessRequest () [0x0000b] in <5b4128956e344d60b82a5fd7012fd8a1>:0
On my development machine runs fine both via xsp4
and via MonoDevelop "run" button. Haven't tried fastcgi-mono-server4
, but if you think it's relevant I will.
As I said above behavior only occurs for urls matching WebAPI routes - e.g. /api/products
, which means configuration works and I suppose it has something to do with the environment.
I have started fastcgi-mono-server
as follows: MONO_OPTIONS=--trace=E:System.Exception fastcgi-mono-server4 /appconfigdir=/etc/mono/fastcgi /socket=tcp:127.0.0.1:9000
and when hitting WebAPI urls it outputs this:
[0x7f8276459700:] EXCEPTION handling: System.ArgumentNullException: Value cannot be null.
Parameter name: path
My code does not do any IO, only database (but we're not quite there yet). As I said above behavior only occurs for urls matching WebAPI routes - e.g. /api/products
, which means configuration works and I suppose it has something to do with the environment.
Upvotes: 0
Views: 639
Reputation: 204
This is happening because a required parameter is missing.
I encountered this today. I found that in /etc/nginx/fastcgi_params, I needed to add the following line:
fastcgi_param PATH_INFO "";
And in the server configuration, I needed to import this file:
server {
listen 80;
...
location / {
...
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
}
}
Of course you might be missing a different parameter.
Upvotes: 2