Speeding up Your Mono Server Application, but Watch the Argument Order

Mono has a –server option that can radically improve the response behavior of .NET server applications when run on Mono. From mono’s man page:

–server: Configures the virtual machine to be better suited for server operations (currently,  allows a heavier threadpool initialization).

However, when I tried using the server option for the first time, I was very disappointed that it didn’t work. After some time I found out that I caused the problem myself. Why? Because

mono MyApp.exe --server

is unfortunately not the same as

mono --server MyApp.exe

The latter is correct and works like a charm (on Mono 3.2.3 and higher).

Mono’s options must be placed before the file name, because otherwise the option is treated as an argument passed to the given .NET application. This is a simple, yet mean mistake, because you are used to append any parameters at the end of a command.

Conclusion: Sometimes it can be helpful to also look at the top of the man page, where it clearly states that the actual argument order is like the following:

mono [options] file [arguments...]

Published by

Christian Liebel

Hey there! I am Christian Liebel from Leimersheim, Germany. I work as a consultant at Thinktecture and I am their representative at W3C. PWA development with Angular and .NET Core is our day-to-day business. Feel free to contact me anytime.

Leave a Reply

Your email address will not be published. Required fields are marked *