Delen via


Some issues when hosting ASP.NET 5 on Ubuntu on Azure

ASP.NET 5 is a new open-source and cross-platform framework for building modern cloud-based Web applications using .NET. We can develop and host a ASP.NET Web application on any platform - Windows, Linux and Mac OS.

 

To make it work on Linux, we can quickly create an Ubuntu VM on Azure and then follow the instructions to Installing ASP.NET 5 On Linux.

 

Here I list some issues when I ran ASP.NET 5 sample applications on Ubuntu on Azure.

 

1. “Cannot handle address family xxxx” error when run “dnu restore”

You create a simple ASP.NET 5 application and then run “dnu restore” to download all packages that are listed in the project.json file. You may encounter “Cannot handle address family xxxx” error.

GET https://api.nuget.org/v3/index.json

Cannot handle address family xxxx

Stacktrace:

   at <unknown> <0xffffffff>

   at (wrapper managed-to-native) System.Net.Dns.GetHostByName_internal (string,string&,string[]&,string[]&) <0xffffffff>

   at System.Net.Dns.GetHostByName (string) <0x00047> at System.Net.ServicePoint.get_HostEntry () <0x001ef>

   at System.Net.WebConnection.Connect (System.Net.HttpWebRequest) <0x001af>

   at System.Net.WebConnection.InitConnection (object) <0x002f3>

   at System.Net.WebConnection.m__0 (object) <0x0001f>

   at (wrapper runtime-invoke).runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff>

 

 

 

Workaround

Try to run the following command to stop Micro Name Service Cache Daemon:

sudo service unscd stop

 

and then run ”dnu restore” again.

 

2.        “HTTP request timed out” error when run “dnu restore”

 

You create a simple ASP.NET 5 application and then run “dnu restore” to download all packages that are listed in the project.json file. You may encounter a lot of “HTTP request timed out” error.

  GET https://www.nuget.org/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.EnvironmentVariables'

Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini

  HTTP request timed out. Retrying.

  GET https://www.myget.org/F/aspnetvnext/api/v2/FindPackagesById()?id='Microsoft.Framework.Configuration.Ini'

Warning: FindPackagesById: Microsoft.Framework.Configuration.Ini

  HTTP request timed out. Retrying.

 

Workaround

Run

export MONO_THREADS_PER_CPU=2000

and then run ”dnu restore” again.

 

 

3.        “failed to locate libcoreclr with error libunwind.so.8: cannot open shared object file: No such file or directory” when you run dnx or dnu command

 

You may experience the following error when you run dnx or dnu command:

 

 

failed to locate libcoreclr with error libunwind.so.8: cannot open shared object file: No such file or directory

 

 

Resolution

libunwind8 was not installed. Run the following command to install it:

sudo apt-get install libunwind8

 

4.        “The type initializer for 'libcrypto' threw an exception” error when run your application

 

After successfully run “dnu restore”, you may start to run your application. And the following error may appear:

 

System.TypeInitializationException: The type initializer for 'libcrypto' threw an exception.

 

 

Resolution

libssl-dev was not installed. Run the following command to install it:

 

sudo apt-get install libssl-dev 

 

 

Thanks,

Xin Jin

Comments

  • Anonymous
    March 23, 2016
    THANK YOU