First, it should be made perfectly clear that MIDI files are not themselves "played" in the same manner as an MP3. There is no actual music in a MIDI file; instead they just contain the notes which should be played by a synthesized music instrument.
I'm not sure if silverlight has a built-in MIDI synthesizer (like QuickTime does if you drag a MIDI file on top of it), and a bit of quick googling seems to confirm this hypothesis.
So if you are going to sequence arbitrary MIDI data, and do not have the ability to first bounce it down to MP3, then you should generate the sound on the server-side. If you have access to a .NET backend server, then you could use the VST.NET framework to create a VST host, send the MIDI through an instrument, and compress the resulting audio output to MP3. If you are working with Java, then you can use the jVSTwRapper, a similar library.
In the worst case, you can glue something together with C/C++ to load the VST plugin which will process your sound. This could then be launched as an external process by whatever server technology you are using.
But in all of these approaches, the strategy is basically the same:
- Get the MIDI file from the user and send it to the server.
- Open a VST plugin which will process the sound.
- Parse the events in the MIDI file, sending blocks of floating point data to the plugin with the appropriate MIDI messages.
- Take the output from the plugin and save it to disk somewhere.
- After all this has been done, take the output and convert it from raw PCM to MP3 (or whatever) via LAME or some other encoding framework.
- Send this file back to the user.
Note that step 3 is probably the hardest one in this process. There are lots of guides out on the internet about how to make your own VST host, including that one which I wrote. ;)