0

I am trying to run a .Net WebApi using dnx and kestrel on my CentOS machine, and I am getting a lot of "The type or namespace 'blah' does not exist in the namespace 'blahblah'" errors, which hints, that dnx is for some reason using some old assemblies, which indeed do not have the latter defined. By this moment I have been successfully running the same WebApi with mono on the same machine as a selfhosted application. It has been also successfully compiled with xbuild, but no luck with compiling it with dnx and hosting on kestrtel so far. This is my first experience with dnx, and I am sure, that I am doing something wrong, but googling and reading still did not help me understand, what is wrong exactly. My project.json is as follows :

    {
"webroot": "./",
"dependencies": {
    "Kestrel": "1.0.0-beta5",
    "Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
    "Microsoft.AspNet.Hosting": "1.0.0-beta5",
    "Microsoft.AspNet.Mvc": "6.0.0-beta5",
    "Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
    "Microsoft.Framework.ConfigurationModel.Json": "1.0.0.0-beta5",
    "System.Net.Http": "4.0.0-beta5",
    "System.Web.Http": "2.0.0",
    "Autofac": "3.5.2",
    "Autofac.WebApi2": "3.4.0",
    "Microsoft.AspNet.Cors": "5.2.3",
    "Microsoft.AspNet.SignalR": "2.2.0",
    "Microsoft.AspNet.SignalR.Core": "2.2.0",
    "Microsoft.AspNet.SignalR.JS": "2.2.0",
    "Microsoft.AspNet.SignalR.SystemWeb": "2.2.0",
    "Microsoft.AspNet.WebApi": "5.2.3",
    "Microsoft.AspNet.WebApi.Client": "5.2.3",
    "Microsoft.AspNet.WebApi.Core": "5.2.3",
    "Microsoft.AspNet.WebApi.WebHost": "5.2.3",
    "Microsoft.Owin": "3.0.1",
    "Microsoft.Owin.Cors": "3.0.1",
    "Microsoft.Owin.Host.SystemWeb": "2.1.0",
    "Microsoft.Owin.Security": "3.0.1",
    "Newtonsoft.Json": "5.0.4"
},
"commands": {
    "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001",
    "kestrel": "Microsoft.AspNet.Hosting --server Kestrel --server.urls http://localhost:5004"
},
"frameworks": {
    "dnx451": {
    }
}}

The greatest deal of errors are related to System.Configuration.Configurationmanager, which dnx fails to locate in System.Configuration and types from System.Runtime.Caching, in the latter case dnx cannot find System.Runtime.Caching at all. The errors also say, that dnx verison I am using is v4.5.1, which, I suppose, should understand .Net 4.5.1. The dnvm list command shows 1.0.0-beta6. Is it possible, that I have to provide the necessary dlls manually ? If so, where should I put them ? If the cause of this problem is different, what could it be? I would appreciate, if someone could explain the basics about dnx : i.e, where do I find its configuration files, where does it put packages and dlls, does it use mono, or it has its own runtime, what compiler does it use, and should I fetch its specific version, etc.

DavidG
  • 113,891
  • 12
  • 217
  • 223
user2082616
  • 195
  • 1
  • 17

1 Answers1

1

You are targeting the dnx451 framework which is the full .Net Framework SDK. This framework is not available on CentOS (RedHat Clone right?) but only dnxcore.

Your dependencies have multiple implementations inside, one for dnx and one for dnxcore. If you compile to dnx451 the dependency will use the implementation for dnx451 which has a dependency to the .Net Framework SDK. If you would compile to dnxcore, the dependency would use the dnxcore implementation which (probably) do not use the System.Configuration.ConfigurationManager.

The System.Configuration namespace was rewritten as part of the .Net Core.

But as always with DNX: All beta, bugs are everywhere.

Thomas
  • 5,080
  • 27
  • 42