¿Por qué c # wrapper de c ++ crash bloquea la aplicación web pero funciona bien como aplicación de consola?

I am trying to use the C# wrapper of the C++ Spotify library within a web app.

https://github.com/jonasl/libspotify-sharp

When I compile my code as a console app separate from the web app it runs fine, but when I try and run the class from within my web app the web server crashes.

WebDev.WebServer40.exe has stopped working

It also crashes IIS Express.

Can anyone tell me what can cause this? It would make my life much easier if I can run this code from within the web app.

preguntado el 09 de marzo de 12 a las 14:03

Tal vez eso pueda ayudar blogs.msdn.com/b/vbteam/archive/2008/03/24/… but maybe not. It's about STAThread vs. MTAThread -

1 Respuestas

The spotify library is written in such a way that using it on a website doesn't make sense. Since an ASP.NET site is technically stateless, you can't do things like register the callbacks or anything since once the request is completed, all of your objects are going to be garbage collected.

You might have better luck writing a separate server application that the web site can have a running spotify session and then respond to commands from the web site. It's not a great model though.

Respondido 11 Abr '12, 20:04

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.