dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.28k stars 9.96k forks source link

An exception was thrown by the type initializer for HttpApi #107

Closed lucasteles22 closed 10 years ago

lucasteles22 commented 10 years ago

Hi guys, I am trying build an environment on my mac osx to run the project VNext. However, I can't run the project Web (k web), but I can run the project console (k run). When I run the project web, the terminal show me this message: "An exception was thrown by the type initializer for HttpApi - httpapi.dll". I follow all steps to build the enviroment on my mac osx. 1) I tried run the project VNext with KRE version "kvm install 0.1-alpha-build-0446", as show below: screen shot 2014-07-30 at 9 45 59 am

My project.json to KRE version above screen shot 2014-07-30 at 9 47 01 am

I still tried to make an update on my KRE version, as show below: screen shot 2014-07-30 at 9 49 27 am

and my project.json... screen shot 2014-07-30 at 9 51 06 am

To both KRE versions, the exception "An exception was thrown by the type initializer for HttpApi" is displayed.

Any suggestion to fix my wrong? Any idea?

Praburaj commented 10 years ago

To run an aspnetvnext web application on mac you need to use Kestrel (the cross platform server). WebListener is not expected to work on mac. Try installing alpha3 builds of all these packages and install Kestrel as well like this : https://github.com/aspnet/MusicStore/blob/dev/src/MusicStore/project.json#L8. Setup a command for Kestrel like this https://github.com/aspnet/MusicStore/blob/dev/src/MusicStore/project.json#L25 and to run the application.

lucasteles22 commented 10 years ago

THX. Now it's working for me However, I don't understand which is difference between "k web" and "k Kestrel". On windows, "k web" works for me.

desdesdes commented 10 years ago

k web is using Microsoft.AspNet.Server.WebListener (see project.json) which uses httpapi.dll. This is only available on windows. Kestrel uses libuv which is a binary bundled with the package and is available on windows and osx. linux support is still missing there also, see https://github.com/aspnet/KestrelHttpServer/issues/10. If you want to host on linux you could look at nowin, see https://github.com/Bobris/Nowin.

monoman commented 10 years ago

You are choosing the "web server" to use. "k web" works in Windows because it uses an web server that works in windows only (for now at least).

Rafael Teixeira O..:.)oooo

On Thu, Jul 31, 2014 at 5:36 PM, Lucas da Veiga Teles < notifications@github.com> wrote:

THX. Now it's working for me However, I don't understand which is difference between "k web" and "k Kestrel". On windows, "k web" works for me.

— Reply to this email directly or view it on GitHub https://github.com/aspnet/Home/issues/107#issuecomment-50814874.