I have a Web API that is using .NET 4.0 which I'm now trying to deploy on Debian.

I've followed a few tutorials on how to do this, e.g. Running ASP.net Web API Services under Linux and OSx.

$ /etc/nginx/sites-available/default:

server {
    listen        80;
    root          /var/www/API/;
    index         index.html index.htm default.aspx Default.aspx index.cshtml Index.cshtml;
    server_name   localhost;

    location / {
        fastcgi_index    Index.cshtml;
        include          /etc/nginx/fastcgi_params;

I added the following to /etc/nginx/fastcgi_params:

fastcgi_param    PATH_INFO          "";
fastcgi_param    SCRIPT_FILENAME    $document_root$fastcgi_script_name;

Then I started nginx and the mono server:

# /etc/init.d/nginx start
# fastcgi-mono-server4 /applications=/localhost:/var/www/API/ /socket=tcp: /verbose=True

Then when I try to access the site the log gives warnings and errors that I've failed to find a solution for:

Warning: Duplicate name, SCRIPT_FILENAME, encountered. Overwriting existing value.
Error: No application defined for: localhost:80/Index.cshtml

The warning is generated because you have two SCRIPT_FILENAME lines in your /etc/nginx/fastcgi_params file. The original value and the new value you added. You should comment out the old value to suppress the warning message.

The error is generated because the syntax of your fastcgi-mono-server4 command invocation is wrong. The /applications element should probably be something like:


See this document for further details.

  • The first thing I tried when I encountered that warning was to comment out the original line named SCRIPT_FILENAME but that didn't do anything. I will, however read through that document and see if anything in it will solve my issues. Thanks. – Erik Karlstrand Nov 25 '15 at 13:35
  • I tried to comment out the first SCRIPT_FILENAME again and this time the warning actually disappeared. Sadly, I still get the error saying that there's no application defined for localhost:80/Index.cshtml. – Erik Karlstrand Nov 25 '15 at 14:43
  • I would suggest you remove localhost altogether. I think you can omit the host component or replace it with *, at least until you get it working. – Richard Smith Nov 25 '15 at 14:50
  • Omitting localhost got rid of the error. Now I'm left with other issues that seem to be related to the actual code of my API. Still, I think it would be useful to be able to include an actual host in the future, like www.myapi.com, so any thoughts on how to fix that issue would be appreciated. You have, however, helped me going forward. – Erik Karlstrand Nov 25 '15 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.