tugberkugurlu / k-http

ASP.NET 5 Command-line HTTP server to host static files
MIT License
15 stars 3 forks source link

TypeLoadException for Microsoft.AspNet.Hosting.WebHost #5

Closed akoeplinger closed 9 years ago

akoeplinger commented 9 years ago

I'm recently getting System.TypeLoadException: Could not load type "Microsoft.AspNet.Hosting.WebHost" from assembly "Microsoft.AspNet.Hosting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" when invoking k-http.

Looks like this is caused by https://github.com/aspnet/Hosting/commit/234bbf82f2329e1ce2092962264ba5d4567d115b

You should probably pin to a specific version until the breaking changes are over.

tugberkugurlu commented 9 years ago

Inside the readme, the supported version is highlighted and for the 0.1.0-beta-002 release, it's dnx 1.0.0-beta5-11593. Unfortunately, you cannot specify which version of the runtime you support with global installs. So, you need to be in that specific DNX version to make things work.

Also, I already reacted to that but didn't push NuGet package yet.

akoeplinger commented 9 years ago

Ah, gotcha, I was confused cause the readme already specifies beta5-11611 as compatible :)

However, I seem to also get the same error when switching to 11593:

PS C:\Users\Alexander> dnvm list

Active Version           Runtime Architecture Location                         Alias
------ -------           ------- ------------ --------                         -----
       1.0.0-beta5-11485 clr     x86          C:\Users\Alexander\.dnx\runtimes
  *    1.0.0-beta5-11593 clr     x86          C:\Users\Alexander\.dnx\runtimes
       1.0.0-beta5-11596 clr     x86          C:\Users\Alexander\.dnx\runtimes
       1.0.0-beta5-11611 clr     x86          C:\Users\Alexander\.dnx\runtimes default

PS C:\Users\Alexander> k-http
System.TypeLoadException: Der Typ "Microsoft.AspNet.Hosting.WebHost" in der Assembly "Microsoft.AspNet.Hosting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" konnte nicht geladen werden.
   bei Program.Main(String[] args)
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   bei Microsoft.Framework.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   bei Microsoft.Framework.ApplicationHost.Program.Main(String[] args)
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   bei dnx.host.Bootstrapper.RunAsync(List`1 args)
   bei dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args)
   bei dnx.host.RuntimeBootstrapper.Execute(String[] args)
tugberkugurlu commented 9 years ago

Yes, indeed. I am able to repro this. It's pulling down the latest package from the aspnetvnext feed as the dependency versions are not set to specific version. Current resolution is:

C:\Users\Tugberk.dnx\bin\packages\k-http\0.1.0-beta-002\app>dnu list Listing dependencies for app (C:\Users\Tugberk.dnx\bin\packages\k-http\0.1.0-be ta-002\app\project.json)

[Target framework DNX,Version=v4.5.1 (dnx451)]

Framework references: framework/Microsoft.CSharp 4.0.0.0 framework/mscorlib 4.0.0.0 framework/System 4.0.0.0 framework/System.Collections.Concurrent 4.0.0.0 framework/System.Core 4.0.0.0

Package references:

  • k-http 0.1.0-beta-002 Microsoft.AspNet.FeatureModel 1.0.0-beta5-11393 Microsoft.AspNet.FileProviders.Interfaces 1.0.0-beta5-11284 Microsoft.AspNet.FileProviders.Physical 1.0.0-beta5-11284 Microsoft.AspNet.Hosting 1.0.0-beta5-11672 Microsoft.AspNet.Hosting.Interfaces 1.0.0-beta5-11672 Microsoft.AspNet.Hosting.Server.Interfaces 1.0.0-beta5-11672 Microsoft.AspNet.Http 1.0.0-beta5-11393 Microsoft.AspNet.Http.Core 1.0.0-beta5-11393 Microsoft.AspNet.Http.Extensions 1.0.0-beta5-11393 Microsoft.AspNet.Http.Interfaces 1.0.0-beta5-11393 Microsoft.AspNet.Server.WebListener 1.0.0-beta5-12038 Microsoft.AspNet.StaticFiles 1.0.0-beta5-11825 Microsoft.AspNet.WebUtilities 1.0.0-beta5-11393 Microsoft.Framework.Caching.Interfaces 1.0.0-beta5-11261 Microsoft.Framework.ConfigurationModel 1.0.0-beta5-11240 Microsoft.Framework.ConfigurationModel.Interfaces 1.0.0-beta5-11240 Microsoft.Framework.DependencyInjection 1.0.0-beta5-11269 Microsoft.Framework.DependencyInjection.Interfaces 1.0.0-beta5-11269 Microsoft.Framework.Logging 1.0.0-beta5-11266 Microsoft.Framework.Logging.Interfaces 1.0.0-beta5-11266 Microsoft.Framework.OptionsModel 1.0.0-beta5-11243 Microsoft.Framework.Runtime.Interfaces 1.0.0-beta5-11611 Microsoft.Framework.WebEncoders 1.0.0-beta5-11393 Microsoft.Framework.WebEncoders.Core 1.0.0-beta5-11393 Microsoft.Net.Http.Headers 1.0.0-beta5-11393 Microsoft.Net.Http.Server 1.0.0-beta5-12038 Microsoft.Net.WebSockets 1.0.0-beta5-12038 Newtonsoft.Json 6.0.6

I will fix this now and push a new version to NuGet.

akoeplinger commented 9 years ago

Works fine now, thanks :sparkles:

tugberkugurlu commented 9 years ago

great! Release notes are here: https://github.com/tugberkugurlu/k-http/releases/tag/0.1.0-beta-003